I’m using v26, but I faced this issue in v25.1 too.
content folder I have:
I expected hugo generate this:
But hugo generate:
Is there any related config or it’s a bug?
The extra index.html files are empty. is there any way to tell hugo don’t generate them?
The big problem is, the link of this unexpected
index.html files are in generated
You can create a single page and override it’s url:
Now, you still get /c/index.html. I don’t know how to prevent hugo from creating that page. But you’re a step closer.
I suggest you adjust your template and make sure they’re not empty. It is called nested sections.
Will give you sections A, B, and C.
If you don’t want a section in C, then don’t put a “_index.md” in it; try “index.md”.
Thanks for the answer.
C give me
A/index.html but I need to have
A/B/C/index.html, I used nested folders, because I want to have more keywords in my urls. seo thing I mean.
How I can get that URL but not that empty/extra
I solved this by using
URL in front matter section.
No instead of using nested folders, I put
page.md file in root of
content folder, and set
url option to what I want.
Thanks for your time and answers.
It’s bad practice to have a directory without an index file in it, and even worse to add directories that aren’t needed. Search engines are likely to lower your ranking for that.
If you really want keywords in your URL, then have one directory named A-B-C not three nested ones to give you A/B/C (unless you have content for A or B too).