From 98ddc91a251f3c1efaf1c5d58f565570a6892e18 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 24 Feb 2024 09:48:32 -0800 Subject: [PATCH] List page kinds to which a taxonomy term may be applied --- content/en/content-management/front-matter.md | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/content/en/content-management/front-matter.md b/content/en/content-management/front-matter.md index a5a2d4bb7..b6596a67e 100644 --- a/content/en/content-management/front-matter.md +++ b/content/en/content-management/front-matter.md @@ -293,7 +293,7 @@ genre = 'genres' Add taxonomy terms as shown below: -{{< code file=content/example.md >}} +{{< code-toggle file=content/example.md fm=true >}} title = 'Example' date = 2024-02-02T04:14:54-08:00 draft = false @@ -302,9 +302,30 @@ tags = ['red','blue'] genres = ['mystery','romance'] [params] author = 'John Smith' -{{< /code >}} +{{< /code-toggle >}} -Access taxonomy terms from a template using the [`Params`] or [`GetTerms`] method on a `Page` object: +You can add taxonomy terms to the front matter of any these [page kinds]: + +- `home` +- `page` +- `section` +- `taxonomy` +- `term` + +[page kinds]: /getting-started/glossary/#page-kind + +Access taxonomy terms from a template using the [`Params`] or [`GetTerms`] method on a `Page` object. For example: + +{{< code file=layouts/_default/single.html >}} +{{ with .GetTerms "tags" }} +

Tags

+ +{{ end }} +{{< /code >}} [`Params`]: /methods/page/params/ [`GetTerms`]: /methods/page/getterms/