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:
opened 07:09PM - 16 Jul 23 UTC
NeedsTriage
Proposal
The `taxonomyTerm` page kind was effectively aliased to the `taxonomy` page kind⦠in [v0.73.0](https://github.com/gohugoio/hugo/releases/tag/v0.73.0). It's been three years; we should start throwing a deprecation warning.
While the body's open, it would be helpful if we threw a warning or error when `disableKinds` contains invalid page kinds.
Somewhat related: <https://github.com/gohugoio/hugo/issues/11257>
opened 07:34PM - 16 Jul 23 UTC
Bug
NeedsTriage
With this site configuration:
```toml
disableKinds = ['taxonomyTerm']
```
β¦
Published with v0.111.3
```text
public/
βββ category/ <-- taxonomy page not rendered (as expected)
β βββ category-a/ <-- term page rendered (as expected)
β βββ index.html
β βββ index.xml
βββ posts/
β βββ post-1/
β β βββ index.html
β βββ index.html
β βββ index.xml
βββ favicon.ico
βββ index.html
βββ index.xml
βββ sitemap.xml
```
Published with v0.112.0
```text
public/
βββ category/ <-- taxonomy page rendered (unexpected), term page not rendered (unexpected)
β βββ index.html
β βββ index.xml
βββ posts/
β βββ post-1/
β β βββ index.html
β βββ index.html
β βββ index.xml
βββ favicon.ico
βββ index.html
βββ index.xml
βββ sitemap.xml
```
Related: <https://github.com/gohugoio/hugo/issues/11256>
Reference: <https://discourse.gohugo.io/t/45309>
1 Like