How to disable taxonomy pages but not taxonomy term pages?

I have the following taxonomy and taxonomy term:

[taxonomies]
  auteur = "auteurs"

I want to disable the example.com/auteurs/ page, but keep the example.com/auteurs/john/ and example.com/auteurs/steve/ pages. How to do so?

I found on the forum that in 2020 we had to do:

disableKinds = ["taxonomy"]

But with that in my config, example.com/auteurs/ still renders. This setting seems ignored, because the error that the 2020 post mentions due to disableKinds I neither get.

What am I missing?


C:\>hugo env
hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended windows/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.20.1"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"

Oops! I’ve made a TOML mistake. I had this:

[taxonomies]
  auteur = "auteurs"

disableKinds = ["taxonomy"]

But with this configuration, disableKinds is a child of taxonomies. Which indeed doesn’t work.

After fixing it to this:

disableKinds = ["taxonomy"]

[taxonomies]
  auteur = "auteurs"

It does work! :slightly_smiling_face: Now example.com/auteurs/ doesn’t render, and example.com/auteurs/john/ does.

That’s what I get for trying too long without a break from the computer screen. :smile: I’ll keep the topic here in case someone else in the future can also use a break when working with Hugo’s taxonomies.

Be aware of this:
https://github.com/gohugoio/hugo/issues/8498

After the change you’ll need to use build options to control rendering.

1 Like

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