YAML Frontmatter
Pages can use an optional YAML frontmatter block to configure the behaviour of the page and to provide custom data, if required.
Frontmatter blocks are defined at the top of a page and consists of a valid block of YAML sandwiched between triple-dashes:
---
title: YAML Frontmatter Example
label: Frontmatter
---
Page content here.
Available options
The following frontmatter options are available for each page:
id | A custom page ID that can be used for linking to it from other pages |
label | The name of the page that will be displayed in the navigation (auto-generated from the file name if not set) |
title | The main page title displayed on the page (defaults to the label value if not set). |
hidden | If |
landing | Set to |
header | Set to |
footer | Set to |
data | Optional hash of custom data to make available for use in the page - see info on page variables & data. |
Default values
You can set global default values for page options in the application configuration:
# config/application.rb
config.lookbook.page_options = {
footer: false,
data: {
brand_colors: {
red: '#ff0000'
}
}
}
These will be merged with any page-level frontmatter data. Options set in the frontmatter will override those set at the global level (apart from data
, which will be deep-merged with the any globally defined data).