Frontmatter
LFP Docs supports YAML and JSON frontmatter data.
Frontmatter settings affect the presentation of the one file, where they are defined. See the reference for an extensive list of all options.
Default And Mandatory Keys
There are a couple of keys that must be present for Eleventy and LFP Docs to properly parse the document:
title: the title of the page so that it can be rendered as a link in navigation menus
By default, LFP Docs adds a couple of other frontmatter keys from that you should refrain to overwrite them:
config: the global configuration that you set in the plugin optionsdate: by default, LFP Docs uses Eleventy's magic string"git Last Modified"to add the latest modification date to a single pagelang: when supplied with alangoption in the configuration, this key is setlayout: when using the default theme, overwriting this key would result in a page that is not rendered with the default components and styling, make sure to provide a supplementlocaleLinks: when writing multi-lingual projects, this value gets set; see the reference and internationalization
For hooking into LFP Docs's content structuring, there are a couple of more keys:
category: set the category to group related pages in a collapsible list within the sidebartopic: set the topic to group related pages as a separate menu item in the top-level navigation
Directory Data Files
Eleventy offers additional ways to define frontmatter, on a broader scale, by creating directory-wide JSON definitions. Let's say, the project is structured as follows:
└─ docs
├─ guide
│ ├─ getting-started.md
│ └─ deploying.md
└─ reference
├─ cli.md
└─ configuration.md
If you would want to add the same frontmatter value to getting-started.md and deploying.md, and the same key should have another common value for all files inside /reference, you can add guide.json to /guide (reference.json for /reference) and set your frontmatter there. Eleventy automatically sets these on all files inside this directory and its subdirectories.
└─ docs
├─ guide
│ ├─ guide.json
│ ├─ getting-started.md
│ └─ deploying.md
└─ reference
├─ reference.json
├─ cli.md
└─ configuration.md
Overwriting Settings
In accordance to Eleventy's concept of data cascades, values set in the frontmatter section of a page overwrite those defined in directory files, which in turn overwrite anything that might be defined globally.
Adding Custom Data
By design, frontmatter is a flexible and free way of passing per-page data to the renderer. LFP Docs tries to adhere to this principle, but there are a couple of keys that the default theme has to reserve for its own use (see the approbriate section).
Other than the aforementioned reserved keys, you are free to add your own. For example, add a draft key that accepts boolean values and follow through Eleventy's example to introduce drafts.
You can also still use Eleventy's tag feature to introduce a custom content hierarchy structure (for example, when featuring a blog or changelog).