Hugo creates an index.html file and rss.xml file in my /category/ directory

Hugo creates an index.html file and rss.xml file in my /category/ directory.

Is there a way to turn this off?

I just want the following:

/category/category1/
/category/category2/
/category/category3/
/category/category4/

And not an index file in the /category/ folder.

Previous version of Hugo didn’t add it, but the Hugo versions of 2023 add it.

Hugo always creates an index.html for your HTML output. That’s the way it works. That is the way it has always worked.

Hugo version 0.111.3 doesn’t create a HTML and RSS.xml file in my /category/ folder when I use β€œdisableKinds = [β€œtaxonomyTerm”]” in my hugo.toml file.

And when I go to https://www.example.com/category/ it gives a 404 (just like I want it), and https://www.example.com/category/category-name/ shows the page of that category.

If you want to disable creation of taxonomy pages (list of terms) and term pages (list of content with current term):

disableKinds = ['taxonomy','term']

The taxonomyTerm page Kind has been obsolete for several years.

Hugo version 0.112.0: β€œAllow legacy taxonomyTerm in disableKinds”. Like I said before, it works. It doesn’t add a HTML and rss.xml file in the /category/ folder.

And I did not say that I don’t want category pages, I just don’t want an HTML file in the /category/ folder, only in the /category/category-name/ folders.

I want category pages. But a HTML file in the /category/ folder is useless.

I don’t need a page that lists all categories because all categories are already in the menu (navigation) of my website.

So what I want is to have categories like (examples):

/category/books/
/category/movies/
/category/music/

But nothing in the /category/ folder. If you go to /category/ it should give a 404.

What I want works with hugo v0.111.3, but when I want to use a newer version of Hugo, it doesn’t work anymore.

I must be doing something wrong or different.

hugo v0.115.3-5c2e014a5150553a9fa4f9c1eb7dc4db89c0f1ab+extended linux/amd64 BuildDate=2023-07-13T16:11:34Z VendorInfo=gohugoio

config

disableKinds = ['taxonomy']

[taxonomies]
category = 'category'

structure

content/
β”œβ”€β”€ posts/
β”‚   └── post-1.md  <-- category = ['category-a']
└── _index.md

published

public/
β”œβ”€β”€ category/     <-- no index.html or index.xml in this directory
β”‚   └── category-a/
β”‚       β”œβ”€β”€ index.html
β”‚       └── index.xml
β”œβ”€β”€ posts/
β”‚   β”œβ”€β”€ post-1/
β”‚   β”‚   └── index.html
β”‚   β”œβ”€β”€ index.html
β”‚   └── index.xml
β”œβ”€β”€ favicon.ico
β”œβ”€β”€ index.html
β”œβ”€β”€ index.xml
└── sitemap.xml

I’ve logged a couple of issues related to the obsolete (but not yet removed) taxonomyTerm page kind:

1 Like