Hugo Taxonomies

Posted on Jan 10, 2021

Hugo automatically generates listing pages, which can be confusing. It can also be frustrating if you want to have a page with a certain name and also a folder with that same name. For example on this site I have an article called git.md and articles in a folder called git, so git is added to the URL of those pages, like /git/git-cheat-sheet.md .

content/
  |-git/
    |-git-cheat-sheet.md
  |-git.md
config.toml

In this case Hugo’s default behavior is to overwrite the page created by the git.md file at {your-domain}/git with a listing page containing all the .md files in the git/ folder.

In addition to listing pages for folders Hugo autogenerates listing pages for tags. Both of these behaviors can be helpful, but there may be times when you want to overwrite them. Fortunately Hugo makes this easy to accomplish in the config. file.

Taxonomies: Automatically Generated Listing Pages

In Hugo these automatically generated listing pages are called Taxonomies . The two types of taxonomies are:

  • Tags
  • Categories Listing pages are generated by default for all tags and all folders located within the content/ folder.

Disabling Taxonomy Generation

Taxonomies are controlled by a setting, unsurprisingly called taxonomies, in the Hugo config file.

# config.toml

[taxonomies]
  category = "categories"
  tag = "tags"

If you do not want Hugo to create categories, listing pages for every folder within the content/ folder, remove the categories line.

# config.toml

[taxonomies]
  tag = "tags"

If you want categories, but not tags, do the same, but remove the tags line.

If you do not want any taxonomies at all they can be disabled by removing the [taxonomies] heading and adding the line:

# config.toml

disableKinds = ["taxonomy", "term"]

If your config file is in yaml, or json, there are examples of the above in those languages in the hugo documentation here .