How to configure a Taxonomy under a Section with Multiple taxonomy terms?

Hello everyone,

I have a custom taxonomy setup and want to have multiple taxonomies terms per post, this is what I have:


  tag = "tag"

  tag = "/news/tag/:slug/"


title: "News test page"
date: 2018-04-11T14:39:08+02:00
draft: false
tag: ["World News", "Technology"] 

But, when I visit /news/news-test I see [World News Technology] as a solid link, and when I click the link I am taken to /news. However if I just have "World News" on it’s own, it works?!

Thanks in advance

If you use a custom taxonomy and put this in your config.toml you also must put the default taxonomies in there as well.

   tag = "tags"
  category = "categories"
  series = "series"

Be aware of singular / plural entries.

Hope this helps.

Hi Leo,
Thank you for the quick reply… I tried adding the default taxonomies but still see the
[World News Technology] :-/

I tried to change tag to topics to see if it worked but it didn’t. I want to have the taxonomy term to be under /news

Updated config.toml

  tag = "tags"
  category = "categories"
  series = "series"
  topic = "topics"

  topic = "/news/topic/:slug/"

You have a repo of this project at Github to take a look at?

Sorry was just setting up a test repo for you:

Hugo Static Site Generator v0.47.1/extended darwin/amd64 BuildDate: unknown

I’m afraid that I cannot look into your project at the moment, but I think that you may find this topic helpful (particularly the 3 last posts) since you are trying to Nest a Taxonomy under a Section.

There are 2 different techniques described in the above topic about Nested Taxonomies and a link to a sample repository.

I looked at the repo and indeed @alexandros is right. Please check the article

thank you @Leo_Merkel and @alexandros I thought it would be a “simple” way of having multiple taxonomies per post, I will read into your repo, thanks again.

Oh, it is absolutely simple. It get’s a bit more complicated when you work with nested sections. Tipp: Before you start digging into those nested sections try to get it running with a normal hugo installation and work from there.

Multiple taxonomy terms per post are doable and well documented on the Hugo Docs.

What you’re trying to do is a bit different. Nesting taxonomies under your /news/ section.

Also when configuring Custom Taxonomy Permalinks the /:slug/variable is used in the URL of that Taxonomy.

Therefore with your configuration:

  tag = "/news/topic/:slug/"

And front matter such as: tag = ["World News", "Technology"]

You would get a URL like: /news/tag/world-news-technology/

What is your desirable URL output?

If it is /news/tag/world-news/ and /news/tag/technology/ then I would suggest using 2 different shadow taxonomies like so:

  world-news = "world-news"
  technology = "techonology"

  world-news = "/news/tag/:slug/"
  technology = "/news/tag/:slug/"

And in your front-matter like so:

world-news = "World News"
technology =  "Technology"

That’s what I would do. Now if someone else has a smarter way of doing this, hopefully they will chime in.

Yep that’s what I would like to have… Ok so if I wanted to have say 10 taxonomies terms for News, I would have to define all of the [permalinks] once really in the config and then add it to the front matter. However if I have say 200 posts and add a new taxonomy term, then I would have to edit 200 posts which is the downside of that :-/

If the project you’re working on is so huge then I think that you would need to go with the default Hugo tags and categories as documented in the Docs and then maybe use some kind of URL rewrite on your server to have them under /news/

I am afraid that I cannot help with URL rewriting on a server though.

Yeah that is an idea I guess, thanks again I will think of something :slight_smile:

The taxonomy needs to be plural in front-matter.


tags: ["World News", "Technology"]

Didn’t work, but in my case it still would not work as the tags are not in the root of my site but nested under: news

Hmm, in that case, it might help us help you better if you can share the git repo for this project. It would be faster that way…


I found the time to have look in your Repo and sent you a PR.

It is very much possible to have a Nested Hugo Taxonomy under a Section with Multiple Terms.

Sorry for saying that this is not possible above. I should have spoken after taking your repo for a spin.

P.S. I renamed your topic to something more informative.

I am working on a PR for the Hugo Docs about Nested Taxonomies.

This is an undocumented feature that has been available since Hugo 0.31
See the relevant commit here

The use case of this feature is described in this thread i.e. a Nested Taxonomy under a Section with multiple Taxonomy Terms and also in this topic about Chronological Blog Archives.

Once I’m ready I will send it for review.

P.S. I started working on this a few days ago but got sidetracked.


@alexandros sorry just came back to the office and saw your PR, tested it out and bingo!.. THANK YOU so much for this :)))))))))!!! Amazing work, I am so happy I can get it to work this way and not having to add all of the permalinks by hand each time. I knew there was an easier way since Hugo is so advanced in its features!

Thank you everyone!!