I’ve been trying to narrow down some unexpected behavior, and I’m not sure if it’s unexpected to me because I’ve failed to understand something fundamental to the hugo library, or if it’s actually unexpected and an indication of a bug.
Here’s what I’m observing:
- Generate a new hugo site
- Create a
layouts/_default/single.html
template - Create a
content/a.md
markdown file
Generating the site with hugo
creates the public/a/index.html
page as expected.
If I then add a content/index.md
file, then public/index.html
gets generated with the content of index.md
using the single page template, but a.md
is no longer used to generate the a/index.html
page.
If I build this up using three templates instead of just the one, then I can reproduce the issue with a.md
not getting generated.
layouts/
├── _default
│ ├── list.html
│ └── single.html
└── index.html
If I create the content like this, then everything works as expected. I get a home page that uses the layouts/index.html
file, and includes _index.md
.
content/
├── _index.md
└── a.md
If I add a content/index.md
file to this and regenerate, it’s all fine. The superfluous index.md
file gets ignored. However, if I had mistakenly created an index.md
instead of an _index.md
, then a.md
again doesn’t get generated. (The home page is also empty, of course, since there’s no _index.md
to pull content from).
Is it a bug that a.md
does not get generated in the presence of an index.md
file?