orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
513 stars 53 forks source link

Copper: document how to adjust layoutConfig #346

Closed eiswind closed 4 years ago

eiswind commented 4 years ago

The CopperTheme has some variables like

{% if layoutConfig.includeBreadcrumbs %}

I tried to understand the code from:

fun getLayoutConfig(layoutName: String, data: Map<String, Any>?): Any? {
        return when(layoutName) {
            "homepage" -> CopperHomepageLayoutConfig().also { it.extractOptions(context, data) }
            else -> CopperSidebarLayoutConfig().also { it.extractOptions(context, data) }
        }
    }

But still I do not have any clue how to set these parameters.

It would be great if this could get some documentation.

cjbrooks12 commented 4 years ago

The implementation of these "layout configs" is still very much a work-in-progress. You're welcome to customize them yourself, but how they work is likely going to change in future releases. I'll make sure to include in release notes if/when they change, so it shouldn't surprise you.

There are currently only configurations available for the default layout from Copper. No other layouts or themes use them, currently. The main idea is that the configurations are provided individually from each page, either in its Front Matter or from an Archetype. Basically, they're used alongside the existing layout property for pages.

The available options are defined in this file, but you can also see them in the admin panel at this URL when it's running locally.

Here's a snippet showing how you'd customize the layout configs for static pages, for example:

# config.yml
pages:
  staticPages:    # <-- Static pages Archetype key
    layoutConfig: # <-- configures the default Copper layout for static pages
      wrapPageInBox: false
      wrapTitleInBox: false
      includeTitle: false
      includeBreadcrumbs: false
eiswind commented 4 years ago

Thanks for clearing that up!