Taxonomy/terms (category/tag) templates based on section

I’ve been searching the forums, looking for a clean way to have taxonomy/terms (category/tag) templates based on section.

I was thinking about how I could create:

/development/categories/front-end/

or

/development/tags/css/

I did not see a way to have taxonomy templates under a section in the lookup order docs.

As of Dec. 2022, is there a clean way to do this?

One idea that came to my mind is to create a theme, and then have two Hugo sites. This could be a nice way of separating content whilst keeping the look/feel the same. On the other hand, I don’t know if I’d want to juggle multiple sites.

Thanks!

This creates taxonomies that are unique to a particular content .Type (the top level section). The authors taxonomy is specific to books, and the actors taxonomy is specific to films.

structure

content/
β”œβ”€β”€ books/
β”‚   β”œβ”€β”€ book-1.md
β”‚   └── book-2.md
β”œβ”€β”€ films/
β”‚   β”œβ”€β”€ film-1.md
β”‚   └── film-2.md
└── _index.md

site configuration

[taxonomies]
'books/authors' = 'books/authors'
'films/actors' = 'films/actors'

content/books/book-1.md

title = 'Book 1'
date = 2022-12-26T13:45:46-08:00
draft = false
'books/authors' = ['Victor Hugo']

published site

public/
β”œβ”€β”€ books/
β”‚   β”œβ”€β”€ authors/
β”‚   β”‚   β”œβ”€β”€ charles-darwin/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   β”œβ”€β”€ victor-hugo/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ book-1/
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ book-2/
β”‚   β”‚   └── index.html
β”‚   └── index.html
β”œβ”€β”€ films/
β”‚   β”œβ”€β”€ actors/
β”‚   β”‚   β”œβ”€β”€ anthony-hopkins/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   β”œβ”€β”€ benedict-cumberbatch/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   β”œβ”€β”€ hugo-grant/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   β”œβ”€β”€ russel-crow/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ film-1/
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ film-2/
β”‚   β”‚   └── index.html
β”‚   └── index.html
β”œβ”€β”€ favicon.ico
└── index.html
4 Likes

Thank you! Trying now! I will reply with questions or to let you know it works perfectly! I really appreciate the assistance/help!

I’ve added a front matter example. See my previous response.

1 Like

Thank you for your help Joe! I got it working!!! I really appreciate your help!

1 Like

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