--- aliases: - /indexes/displaying/ lastmod: 2016-06-29 date: 2013-07-01 linktitle: Displaying menu: main: parent: taxonomy next: /taxonomies/templates prev: /taxonomies/usage title: Displaying Taxonomies weight: 20 toc: true --- There are four common ways you can display the data in your taxonomies in addition to the automatic taxonomy pages created by hugo using the [list templates](/templates/list/): 1. For a given piece of content, you can list the terms attached 2. For a given piece of content, you can list other content with the same term 3. You can list all terms for a taxonomy 4. You can list all taxonomies (with their terms) ## 1. Displaying taxonomy terms assigned to this content Within your content templates, you may wish to display the taxonomies that that piece of content is assigned to. Because we are leveraging the front matter system to define taxonomies for content, the taxonomies assigned to each content piece are located in the usual place (.Params.`plural`). ### Example
If you want to list taxonomies inline, you will have to take care of optional plural ending in the title (if multiple taxonomies), as well as commas. Let's say we have a taxonomy "directors" such as `directors: [ "Joel Coen", "Ethan Coen" ]` in the TOML-format front matter. To list such taxonomy use the following: ### Example {{ if .Params.directors }} Director{{ if gt (len .Params.directors) 1 }}s{{ end }}: {{ range $index, $director := .Params.directors }}{{ if gt $index 0 }}, {{ end }}{{ . }}{{ end }} {{ end }} Alternatively, you may use the [delimit]({{< relref "templates/functions.md#delimit" >}}) template function as a shortcut if the taxonomies should just be listed with a separator. See {{< gh 2143 >}} on GitHub for discussion. ## 2. Listing content with the same taxonomy term First, you may be asking why you would use this. If you are using a taxonomy for something like a series of posts, this is exactly how you would do it. It’s also an quick and dirty way to show some related content. ### Example