Homepage rendered inconsistently (empty list.html vs. populated index.html)


#1

I’m getting started with Hugo to build a new website, with a from-scratch theme. While starting with the homepage, I’m running into trouble with which template is used. Sometimes it renders as expected with the “layouts/index.html” but usually it renders using “layouts/_default/list.html” but no pages.

As far as I can tell, it’s just random. For a little bit it seemed like changing disableHugoGeneratorInject in my config “fixed” it, or it seemed like setting draft: false fixed it, or passing --disableFastRender to the server, etc. etc. but so far the only theory I’m left with is that each time I run hugo or re-start/re-trigger the server I get a random result :-/

Why would my index.html often get generated with the lists template (which I don’t want — certainly not with a seemingly empty list), but occasionally generate with the index template that I thought it would always use?

I’ve posted the current (problematic) source code at https://github.com/natevw/hugo-homepage-issue/tree/a6ea417c24407b9d0f511605a6238599b3401e23/themes/homespun/layouts

Basically started with:

hugo new site . -f json
hugo new theme homespun

And then went from there. My content/_index.md is very simple and I got rid of the draft: true line to eliminate that as a variable.


#2

Figures I would finally track it down right after posting!

I had tried to clean up the tags/categories folders using a tip I had read somewhere to overwrite the tag/category taxonomies with empty strings (null seemed to work too): Turning off taxonomy pages

So I had this in my config.json:

"taxonomies": {
   "tag": null,
   "category": null
 }

which did get rid of the extra folders, but apparently led to the problem.

The current documentation at https://gohugo.io/content-management/taxonomies/#example-removing-default-taxonomies, however, tells a different story than the empty string. Based on that, here is what gets rid of the default tags/categories but also doesn’t cause hugo to go quietly bonkers:

"taxonomies": {}

#3

From https://gohugo.io/content-management/taxonomies/#default-taxonomies:

{
   "disableKinds": [
      "taxonomy",
      "taxonomyTerm"
   ]
}