Doc

Taxonomies

Taxonomies Sugam Pokharel

Sugo is configured with three taxonomies by default:

TOML
1
2
3
4
[taxonomies]
tag = "tags"
category = "categories"
author = "authors"

These taxonomies are fine for most cases but you may want some custom taxonomies. In order to do so, just add them in the same format as the tag or category taxonomies.

TOML
1
2
3
4
5
6
7
8
9
[taxonomies]
# these are the default taxonomies
tag = "tags"
category = "categories"
author = "authors"
# these are the custom ones
topic="topics"
language="languages"
project="projects"

So any new taxonomy should be in the format of singular= "plural"

Use in front matter

TOML
1
2
3
4
5
+++
tags= ["history", "latin"]
categories= ["Ancient Rome"]
authors= ["Sugam Pokharel"]
+++

Pages for Taxonomies

Hugo automatically creates pages for taxonomies. So, if you have tags taxonomy set up in the hugo.toml as we did in the example above. You can go to /tags to see all the tags that you have used in the hugo site or /tags/tag-name to see all the posts that have the tag called ’tag-name'.

Sometimes you may want to add a bit of information before the taxonomy. For example, let us consider that we want to add You can find all the tags here in the tags page an This page contains all the posts associated with tag-name.. We can do so by creating folders and files with the following structure.

In \content\tags_index.md, add the following:

MARKDOWN
1
2
3
4
5
+++
title="Tags"
+++
 
You can find all the tags here

In \content\tags\tag-name_index.md, add the following:

MARKDOWN
1
2
3
4
5
+++
title="Tag Name"
+++
 
This page contains all the posts associated with tag-name

Share this article

  • X
  • Facebook
  • LinkedIn
  • Reddit
  • WhatsApp
  • Telegram
  • Pinterest
  • Bluesky