Different layout for tag and category pages

I want to have different layout for category pages and different for tag pages but currently don’t know how to tell Hugo to distinguish those.

Currently, both my ‘tag’ and ‘category’ pages rely on the same layout. In my /layouts/taxonomy/ directory I have:

list.html # list of all articles for specific tag or category
terms.html # list of all tags/categories with the post count for each

My config (the important part) looks like this:

permalinks:
  blog: "/:slug/"
  categories: "/category/:slug/"
  tags: "/tag/:slug/"
taxonomies:
  tag: tag
  category: category

You can do this:

/layouts/categories/terms.html
/layouts/tags/terms.html
/layouts/series/terms.html
/layouts/exampletaxonomy/terms.html
/layouts/examplesection/terms.html

Same with the other files that you want to customize on a per taxonomy and section basis like list.html you’ve mentioned.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.