Add Cascade documentation

Fixes #905
This commit is contained in:
Regis Philibert 2019-09-09 18:32:03 -04:00
parent 38a15e6f7d
commit bae2403551

View File

@ -64,6 +64,9 @@ aliases
audio
: an array of paths to audio files related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:audio`.
cascade
: a map of Front Matter keys whose values are passed down to the page's descendents unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
date
: the datetime assigned to this page. This is usually fetched from the `date` field in front matter, but this behaviour is configurable.
@ -152,6 +155,22 @@ include_toc: true
show_comments: false
{{</ code-toggle >}}
## Front Matter Cascade
Any node or section can pass down to descendents a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
### Example
```yaml
# content/blog/_index.md
title: Blog
cascade:
banner: images/typewriter.jpg
```
With the above example the Blog section page and its descendents will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
- Said descendent has its own `banner` value set
- Or a closer ancestor node has its own `cascade.banner` value set.
## Order Content Through Front Matter