diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-10-05 20:01:52 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-10-06 14:06:10 +0200 |
commit | c63db7f1f6774a2d661af1d8197c6fe377e3ad25 (patch) | |
tree | bbeccc7dd4f41acdcc1cfd584ea351e6284869d5 /docs/content | |
parent | 5e2a547cb594b31ecb0f089b08db2e15c6dc381a (diff) |
Allow cascade to be a slice with a _target discriminator
Fixes #7782
Diffstat (limited to 'docs/content')
-rw-r--r-- | docs/content/en/content-management/front-matter.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/content/en/content-management/front-matter.md b/docs/content/en/content-management/front-matter.md index a14cb3065..097cf0598 100644 --- a/docs/content/en/content-management/front-matter.md +++ b/docs/content/en/content-management/front-matter.md @@ -159,6 +159,39 @@ show_comments: false 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. +### Target Specific Pages + +{{< new-in "0.76.0" >}} + +Since Hugo 0.76 the `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets. + +{{< code-toggle copy="false" >}} +title ="Blog" +[[cascade]] +background = "yosemite.jpg" +[cascade._target] +path="/blog/**" +lang="en" +kind="page" +[[cascade]] +background = "goldenbridge.jpg" +[cascade._target] +kind="section" +{{</ code-toggle >}} + +Keywords available for `_target`: + +path +: A [Glob](https://github.com/gobwas/glob) pattern matching the content path below /content. Expects Unix-styled slashes. Note that this is the virtual path, so it starts at the mount root. + +kind +: A Glob pattern matching the Page's Kind(s), e.g. "{home,section}". + +lang +: A Glob pattern matching the Page's language, e.g. "{en,sv}". + +Any of the above can be omitted. + ### Example In `content/blog/_index.md` @@ -174,6 +207,8 @@ With the above example the Blog section page and its descendents will return `im - 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 You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views. |