From c63db7f1f6774a2d661af1d8197c6fe377e3ad25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 5 Oct 2020 20:01:52 +0200 Subject: Allow cascade to be a slice with a _target discriminator Fixes #7782 --- docs/content/en/content-management/front-matter.md | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'docs/content/en/content-management/front-matter.md') 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" +{{}} + +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 [`_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. -- cgit v1.2.3