Deth

Fitness and everything else

How To Stop Hugo From Making Indexes For Sections

By default, Hugo automatically generate a page for each section. When you create a subdirectory in your content folder, the section page that’s auto-generated would list all the static pages in that folder.

I didn’t want that listing, as I’d created my own. I have wanted to solve that for some time, but I kept overlooking the solution. It wasn’t a big enough deal for me to try too hard to figure it out, but it was annoying enough for my needs that I wanted to change the behavior. I could see how it could be handy, but it wasn’t what I wanted. I don’t know how I kept overlooking that. 🤦

Add disableKinds = ["section"] in your config.toml. If you already have tings listed under disablekinds you can just add it.

Sure, it’s a minor change, but I wanted my ~/public_html/ to be a little cleaner with fewer folders that weren’t necessary. I wanted the URLs to be organized a bit differently. Really, it’s just bike shedding at this point, but now I think I have it how I’ve always wanted it.