Which taxonomy configuration means what?

I think I finally wrapped my head around how Hugo manages taxonomies.

I created my own taxonomy topic via the config.toml configuration

  tags = 'tags'
  topic = 'topic'

I also created a page layouts/-default_topics.html and, behold, it works! :person_cartwheeling: I get a page with all posts having a topic of “france” via http://localhost:1313/topic/france

There is one last thing I am missing: how are the three topic instances related: topic= and =topic in config.toml and the topic.html file. What drives what?

I’m not sure I understand your question.

In site config, define a taxonomy using the singular = 'plural' convention:

author = 'authors'

Add terms to content front matter using the plural form:

title = 'Post 1'
date = 2022-05-30T13:32:19-07:00
draft = false
authors = ['John Doe','Jane Doe']

Access the taxonomy object using the plural form:

{{ site.Taxonomies.authors }}

The URL of the taxonomy and term pages uses the plural form:


In taxonomy and term templates[1], access the singular and plural forms with:

{{ .Data.Singular }}
{{ .Data.Plural }}

  1. Example: layouts/_default/taxonomy.html and layouts/_default/term.html ↩︎


Your answer was perfect - thank you very much. It exactly answered my question (I still do not understand why this is so overengineered but there must be a reason for singular and plural forms).

I think that your answer should actually go into the docs - it is really precise.

When visiting https://example.org/authors/jane-doe/ you might want to display the text:

These are the books where the author is Jane Doe:

Note the singular use in the sentence above.

Thank you but I still do not understand why not use only the singular form and have links such as https://example.org/author/(singular) even if there may be more than one. Is it just an aesthetical reason?

Sometimes you may want to render the plural form, and sometimes you may want to render the singular form. If you don’t think you will ever need to render the plural form of the taxonomy, use the same value for both in site config:

author = 'author'
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.