I don't want tags and categories

I have no tags and categories on my site. But Hugo generates an empty page when I visit example.com/tags and example.com/categories. I wrote in the robots.txt

Disallow: /Categories/
Disallow: /tags/

Google find the sites exaple.com and example.com/tags.

See disableKinds

Sorry it doesn’t work. I wrote this in the config.toml

disableKinds = [“categories”, “tags”]

The sitemap.xml has the entries and I can visit example.com/tags and example.com/categories

2 Likes

disableKinds works with “kinds”, which are type of pages. For instance, the homepage is of kind home, and each RSS page has the RSS kind.

To disable category and tags pages, you’ll need to set disableKinds to taxonomy and taxonomyTerm like so:

disableKinds = ["taxonomy", "taxonomyTerm"]

Then it works fine. :slight_smile:

7 Likes

For completeness and for my understanding. How would you do this if you had created your own taxonomy but didn’t want to use categories or tags (but still wanted your custom taxonomy?).

“tags” and “categories” are the default taxonomies. To add/remove custom taxonomies, you would need to configure the taxonomies parameter in the site config. For example, below removes the “tags”, and adds “series”, but retains “categories”:

[Taxonomies]
  category = "categories"
  series = "series"
1 Like

Ah, that’s what I couldn’t remember. Thanks. Hopefully, this will be a reminder to people searching for an answer in the future.

What are you talking about? It’s already documented!


(: sɔop ǝɥʇ pǝʇɐpdn ʇsnɾ I 'ƃuᴉppᴉʞ ʇsnɾ 'ǝɥǝH

1 Like

Ah, you nearly had me there!! I must be tired today.

Note to self - turn down grumpy-old-man mode :slight_smile:

[Taxonomies]

I found out that if I put this empty taxonomies in config.toml, sitemap.xml won’t have /tags and /categories

1 Like