diff options
Diffstat (limited to 'docs/content/en/content-management/taxonomies.md')
-rw-r--r-- | docs/content/en/content-management/taxonomies.md | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/docs/content/en/content-management/taxonomies.md b/docs/content/en/content-management/taxonomies.md index 287c6f899..629fab94d 100644 --- a/docs/content/en/content-management/taxonomies.md +++ b/docs/content/en/content-management/taxonomies.md @@ -82,15 +82,23 @@ Moonrise Kingdom <- Value ... ``` -## Hugo Taxonomy Defaults +## Hugo Taxonomy Defaults {#default-taxonomies} Hugo natively supports taxonomies. -Without adding a single line to your site's configuration file, Hugo will automatically create taxonomies for `tags` and `categories`. If you do not want Hugo to create any taxonomies, set `disableKinds` in your site's configuration to the following: +Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be same as manually [configuring your taxonomies](#configuring-taxonomies) as below: -``` +{{< code-toggle copy="false" >}} +[taxonomies] + tag = "tags" + category = "categories" +{{</ code-toggle >}} + +If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site config][config] to the following: + +{{< code-toggle copy="false" >}} disableKinds = ["taxonomy","taxonomyTerm"] -``` +{{</ code-toggle >}} ### Default Destinations @@ -99,11 +107,15 @@ When taxonomies are used---and [taxonomy templates][] are provided---Hugo will a * A single page at `example.com/categories/` that lists all the [terms within the taxonomy][] * [Individual taxonomy list pages][taxonomy templates] (e.g., `/categories/development/`) for each of the terms that shows a listing of all pages marked as part of that taxonomy within any content file's [front matter][] -## Configure Taxonomies +## Configure Taxonomies {#configuring-taxonomies} -Taxonomies must be defined in your [website configuration][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: Taxonomy Configuration +### Example: Adding a custom taxonomy named "series" + +{{% note %}} +While adding custom taxonomies, you need to put in the default taxonomies too, _if you want to keep them_. +{{% /note %}} {{< code-toggle copy="false" >}} [taxonomies] @@ -112,11 +124,22 @@ Taxonomies must be defined in your [website configuration][config] before they c series = "series" {{</ code-toggle >}} +### Example: Removing default taxonomies + +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" >}} +[taxonomies] + tag = "tags" +{{</ code-toggle >}} + +If you want to disable all taxonomies altogether, see the use of `disableKinds` in [Hugo Taxonomy Defaults](#default-taxonomies). + ### Preserve Taxonomy Values By default, taxonomy names are normalized. -Therefore, if you want to have a taxonomy term with special characters such as `Gérard Depardieu` instead of `Gerard Depardieu`, set the value for `preserveTaxonomyNames` to `true` in your [site configuration][config]. Hugo will then preserve special characters in taxonomy values but will still title-ize the values for titles and normalize them in URLs. +Therefore, if you want to have a taxonomy term with special characters such as `Gérard Depardieu` instead of `Gerard Depardieu`, set the value for `preserveTaxonomyNames` to `true` in your [site config][config]. Hugo will then preserve special characters in taxonomy values but will still title-ize the values for titles and normalize them in URLs. Note that if you use `preserveTaxonomyNames` and intend to manually construct URLs to the archive pages, you will need to pass the taxonomy values through the [`urlize` template function][]. |