diff options
Diffstat (limited to 'docs/content/en/content-management/taxonomies.md')
-rw-r--r-- | docs/content/en/content-management/taxonomies.md | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/docs/content/en/content-management/taxonomies.md b/docs/content/en/content-management/taxonomies.md index af8297876..94f2f6357 100644 --- a/docs/content/en/content-management/taxonomies.md +++ b/docs/content/en/content-management/taxonomies.md @@ -1,14 +1,14 @@ --- title: Taxonomies description: Hugo includes support for user-defined taxonomies. -keywords: [taxonomies,metadata,front matter,terms] categories: [content management] +keywords: [taxonomies,metadata,front matter,terms] menu: docs: parent: content-management weight: 150 -toc: true weight: 150 +toc: true aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes] --- @@ -27,7 +27,6 @@ Term Value : a piece of content assigned to a term - ## Example taxonomy: movie website Let's assume you are making a website about movies. You may want to include the following taxonomies: @@ -82,15 +81,15 @@ Hugo natively supports taxonomies. Without adding a single line to your [site configuration] 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 config="taxonomies" />}} +{{< code-toggle config=taxonomies />}} If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site configuration] to the following: -{{< code-toggle file="hugo" copy=false >}} +{{< code-toggle file=hugo >}} disableKinds = ["taxonomy","term"] {{</ code-toggle >}} -{{% page-kinds %}} +{{% include "content-management/_common/page-kinds.md" %}} ### Default destinations @@ -109,7 +108,7 @@ Custom taxonomies other than the [defaults](#default-taxonomies) must be defined While adding custom taxonomies, you need to put in the default taxonomies too, _if you want to keep them_. {{% /note %}} -{{< code-toggle file="hugo" copy=false >}} +{{< code-toggle file=hugo >}} [taxonomies] tag = "tags" category = "categories" @@ -120,7 +119,7 @@ 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 configuration]. -{{< code-toggle file="hugo" copy=false >}} +{{< code-toggle file=hugo >}} [taxonomies] tag = "tags" {{</ code-toggle >}} @@ -129,14 +128,6 @@ If you want to disable all taxonomies altogether, see the use of `disableKinds` {{% 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. - -Much like regular pages, taxonomy list [permalinks](/content-management/urls/) are configurable, but taxonomy term page permalinks are not. -{{% /note %}} - -{{% 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. {{% /note %}} ## Add taxonomies to content @@ -151,7 +142,7 @@ If you would like the ability to quickly generate content files with preconfigur ### Example: front matter with taxonomies -{{< code-toggle file="content/example.md" fm=true copy=false >}} +{{< code-toggle file=content/example.md fm=true >}} title = "Hugo: A fast and flexible static site generator" tags = [ "Development", "Go", "fast", "Blogging" ] categories = [ "Development" ] @@ -168,7 +159,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 >}} title = "foo" tags = [ "a", "b", "c" ] tags_weight = 22 @@ -178,15 +169,11 @@ categories_weight = 44 By using taxonomic weight, the same piece of content can appear in different positions in different 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 %}} - ## Add custom metadata to a taxonomy or term 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-toggle file="content/actors/bruce-willis/_index.md" fm=true copy=false >}} +{{< code-toggle file=content/actors/bruce-willis/_index.md fm=true >}} title: "Bruce Willis" wikipedia: "https://en.wikipedia.org/wiki/Bruce_Willis" {{< /code-toggle >}} |