Taxonomy

- 99 words - 1 minute

Definition

Taxonomy -> Term -> Page

Example:

category -> Go -> Page

Add in the front matter of some pages anywhere in the site:

title: 'Page 1'
categories: ['Go'] 

title: 'Page 2'
categories: ['Python'] 

Hugo will produce:

  1. A taxonomy page at /categories/index.html that lists ‘Go’ and ‘Python’

  2. A term page at /categories/go/index.html that lists Page1

  3. A term page at /categories/python/index.html that lists Page2

Lookup order

Taxonomy list

Use terms.html [1] :

_default/terms.html
_default/taxonomy.html
_default/list.html

Taxonomy term

Use: term.html [2]

_default/term.html
_default/taxonomy.html
_default/list.html

Customization

[permalinks]
  categories = "/folder/category/:slug/"

References

  1. Layout lookup for taxonomy pages
  2. Layout lookup for term pages