Can you have both index.md and _index.md in the same directory?

I ran hugo server and it ran the server, but when I clicked on the post itself, it didn’t navigate to the post.

You can’t. Both give the containing folder an instruction.

  • index.md instructs hugo to create a single page. It uses the single.html layout
  • _index.md instructions hugo to creates a section. It uses the list.html layout

If you put both, then hugo won’t know which one to choose.

For more on that see here: Page bundles | Hugo

tldr for a given directory you should have one or the other, not both

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.