Use list.html template and not taxonomy template?

Is it possible for Hugo to use thelist.html template file within a content type folder and not the one that is in _default folder? I want to have a few content types (blog, news, travel) and want the taxonomies for each content to use the list.html temple found in each content type folder.

E.g. Travel taxonomy pages will use the list.html template under layouts/travel/list.html and not layouts/_default/list.html. I am in the process of committing to my repo so if you need more clarification then let me know…

Thank you :slight_smile:


BTW your other thread has the same answer as this one.

Also there are topics about making layouts for different content types in the Forum, please use Search.

1 Like

Hi all,
I want to include some json-ld within my head.html partial, but only want it to be outputted when a user visits the news/single.html template and no where else. I can do this with a front matter variable, but wanted to know how to target a single.html template under a content type such as news?

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

I moved the above post here from your other thread because it has the same answer as above.


sorry @alexandros, it was late last night and was unable to test when you replied. I tried looking at the Hugo template lookup and if I am not blind, I can’t see one of the orders as being the list.html template within a content folder?

I had to remove the past repo I did, but I have updated the one I had: I am planning on having many taxonomies and having to created a template per taxonomy, and using the same code as the list.html will be a lot of extra work to maintain.

Also I don’t want to use a _default template for my lists since the design will be different depending on the content type. I also saw there are some hacks out there but wanted to hear if there are other ways of doing this before doing any hacks.

Again, sorry if this is posted somewhere, I am still going through the forums and looking at other themes.

You need to define the type in your front matter and then see the following:

I posted the generic Lookup Order link above.

I added: type: "news" in my front matter and still doest work :disappointed:
I ran hugo --verbose and it says: Unable to locate layout for "taxonomy" it’s not using my news/list.html template.

If this is related to the custom taxonomies of your previous support ticket I haven’t tested those with different layouts templates.

Also since my Docs PR about this technique wasn’t accepted I assume that it is not meant for general use due to various limitations.

However you could write the different content type templates as partials and then call them conditionally in your default list template by checking the Permalink string.

PS I’m not on my workstation as I’m away and I cannot test your repo. Maybe someone else will.

Ok thanks for the heads up.