Hugo

Taxonomy list page takes a wrong template

I have a taxonomy called “collections”

My taxonomy list pages are taking layouts/_defaul/list.html instead of layouts/_default/collection.html. This shouldn’t be the case looking at the Layout Lookup for Taxonomy List Pages

If we go to https://pawsys.github.io/collections/ it displays the list page.

Here is my hugo repo. Here is my Github Pages repo. Any help will be much appreciated!

Hi Paweł!

You can move and rename

/layouts/_default/collection.html

to

/layouts/taxonomy/list.html

or—more specific—

/layouts/collections/list.html.

But there are several options. Have a look at the lookup order.

1 Like

Thanks this works. However, my solution also worked. I didn’t realized because I was confused with the naming and I am still confused…

The taxonomy docs establish naming this way:

Actors (taxonomy): Bruce Willis (term)

However, the lookup order works another way:
foo.com/actors (is a terms page)
foo.com/actors/bruce-willis (is a taxonomy list page)

Is this a naming inconsistency in the taxonomy docs?

It’s possible something is off, the naming of taxonomy and terms is a historical quirk of the Hugo project. Walk me through what seems off to you, though; I get these easily confused.

So, on your site, collections is the taxonomy, whereas idea is a taxonomy term.

  • https://pawsys.github.io/collections/ - taxonomy - layouts/_default/taxonomy.html layouts/_default/list.html
  • https://pawsys.github.io/collections/idea/ - term - layouts/_default/terms.html layouts/_default/list.html

The above is expected behavior. @pawsys are you saying the templates are being picked up in a different order?

Yes, exactly!

if I define layout/_default/taxonomy.html
the page that changes is https://pawsys.github.io/collections/idea/.

and if I define layout/_default/terms.html
the page that changes is https://pawsys.github.io/collections/

it works as if this is the syntax:
Actors (term): Bruce Willis (taxonomy)
but the syntax in hugo docs is:
Actors (taxonomy): Bruce Willis (term)