diff options
Diffstat (limited to 'docs/content/en/content-management/taxonomies.md')
-rw-r--r-- | docs/content/en/content-management/taxonomies.md | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/docs/content/en/content-management/taxonomies.md b/docs/content/en/content-management/taxonomies.md index f5960367f..fe42a0667 100644 --- a/docs/content/en/content-management/taxonomies.md +++ b/docs/content/en/content-management/taxonomies.md @@ -1,6 +1,5 @@ --- title: Taxonomies -linkTitle: Taxonomies description: Hugo includes support for user-defined taxonomies. keywords: [taxonomies,metadata,front matter,terms] categories: [content management] @@ -83,7 +82,7 @@ Hugo natively supports taxonomies. Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configure-taxonomies) as below: -{{< code-toggle copy="false" >}} +{{< code-toggle file="config" copy=false >}} [taxonomies] tag = "tags" category = "categories" @@ -91,7 +90,7 @@ Without adding a single line to your [site config][config] file, Hugo will autom If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site config][config] to the following: -{{< code-toggle copy="false" >}} +{{< code-toggle file="config" copy=false >}} disableKinds = ["taxonomy","term"] {{</ code-toggle >}} @@ -106,7 +105,7 @@ When taxonomies are used---and [taxonomy templates] are provided---Hugo will aut ## Configure Taxonomies -Custom taxonomies other than the [defaults]({{< relref "taxonomies.md#default-taxonomies" >}}) must be defined in your [site config][config] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML. +Custom taxonomies other than the [defaults](#default-taxonomies) must be defined in your [site config][config] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML. ### Example: Adding a custom taxonomy named "series" @@ -114,7 +113,7 @@ Custom taxonomies other than the [defaults]({{< relref "taxonomies.md#default-ta While adding custom taxonomies, you need to put in the default taxonomies too, _if you want to keep them_. {{% /note %}} -{{< code-toggle copy="false" >}} +{{< code-toggle file="config" copy=false >}} [taxonomies] tag = "tags" category = "categories" @@ -125,12 +124,12 @@ While adding custom taxonomies, you need to put in the default taxonomies too, _ If you want to have just the default `tags` taxonomy, and remove the `categories` taxonomy for your site, you can do so by modifying the `taxonomies` value in your [site config][config]. -{{< code-toggle copy="false" >}} +{{< code-toggle file="config" copy=false >}} [taxonomies] tag = "tags" {{</ code-toggle >}} -If you want to disable all taxonomies altogether, see the use of `disableKinds` in [Hugo Taxonomy Defaults]({{< relref "taxonomies.md#default-taxonomies" >}}). +If you want to disable all taxonomies altogether, see the use of `disableKinds` in [Hugo Taxonomy Defaults](#default-taxonomies). {{% note %}} You can add content and front matter to your taxonomy list and taxonomy terms pages. See [Content Organization](/content-management/organization/) for more information on how to add an `_index.md` for this purpose. @@ -138,11 +137,11 @@ You can add content and front matter to your taxonomy list and taxonomy terms pa Much like regular pages, taxonomy list [permalinks](/content-management/urls/) are configurable, but taxonomy term page permalinks are not. {{% /note %}} -{{% warning %}} +{{% note %}} The configuration option `preserveTaxonomyNames` was removed in Hugo 0.55. You can now use `.Page.Title` on the relevant taxonomy node to get the original value. -{{% /warning %}} +{{% /note %}} ## Add Taxonomies to Content @@ -156,7 +155,7 @@ If you would like the ability to quickly generate content files with preconfigur ### Example: Front Matter with Taxonomies -{{< code-toggle copy="false">}} +{{< code-toggle file="content/example.md" fm=true copy=false >}} title = "Hugo: A fast and flexible static site generator" tags = [ "Development", "Go", "fast", "Blogging" ] categories = [ "Development" ] @@ -173,7 +172,7 @@ The following show a piece of content that has a weight of 22, which can be used ### Example: Taxonomic `weight` -{{< code-toggle copy="false" >}} +{{< code-toggle copy=false >}} title = "foo" tags = [ "a", "b", "c" ] tags_weight = 22 @@ -183,7 +182,7 @@ categories_weight = 44 By using taxonomic weight, the same piece of content can appear in different positions in different taxonomies. -{{% note "Limits to Ordering Taxonomies" %}} +{{% note %}} Currently taxonomies only support the [default `weight => date` ordering of list content](/templates/lists/#default-weight--date--linktitle--filepath). For more information, see the documentation on [taxonomy templates](/templates/taxonomy-templates/). {{% /note %}} @@ -191,13 +190,10 @@ Currently taxonomies only support the [default `weight => date` ordering of list If you need to add custom metadata to your taxonomy terms, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter. Continuing with our 'Actors' example, let's say you want to add a Wikipedia page link to each actor. Your terms pages would be something like this: -{{< code file="/content/actors/bruce-willis/_index.md" >}} ---- +{{< code-toggle file="content/actors/bruce-willis/_index.md" fm=true copy=false >}} title: "Bruce Willis" wikipedia: "https://en.wikipedia.org/wiki/Bruce_Willis" ---- -{{< /code >}} - +{{< /code-toggle >}} [`urlize` template function]: /functions/urlize/ [content section]: /content-management/sections/ |