Indexes for categories and tags combination

I am trying to create Content List for combination of Categories/Sections and Tags in the content file.

For example, if I have a tag1 in content file under section category1, I want Index file for all tag1 in category1 at url format like

root.tld/category1/tag1

Essentially, it needs to create index file at Public/category1/tag1/index.html

I tried having category1.tag1.html template under layouts/taxonomy folder. But that doesn’t seem to work.

Please suggest on how this can be achieved. Thank you!!

I’m also new to Hugo but I’ll give it a bash at answering your question.

A tip to start with. When you run the local hugo server, make use of the verbose switch which will give you a lot of information about what is going wrong:

hugo server --watch --verbose

Firstly, in your site wide config.toml file you need to include the following:

[Taxonomies]
	tag = "tags"
	category = "categories"
	...any other desired taxonomies...

Then in your blog post front matter (toml format) you could have the following category and tag listings:

categories = ["category1", "category2"]
tags = ["tag1", "tag2", "tag3"]

If you want an index.html file listing all categories at {baseurl}/categories/, you should place a template html file in the following directory:

<root>/indexes/indexes.html

And finally, in order to display all the blog posts within a particular category, in your layout folder you could have one of the following template files (listed in the order of priority - order obtained from a warning message generated by the verbose flag mentioned above):

taxonomy/category.html

or

indexes/category.html

or

_default/taxonomy.html

or

_default/list.htm
1 Like

Thanks, will give it a try.