Yes, that certainly seems to be the issue, thank you! When I turn on --path-warnings
I get the message:
WARN 2019/05/29 08:45:35 Duplicate target paths: <repo>/public/test/index.html (2)
This is very helpful and important in my case. Perhaps it would be good for it to be turned on by default.
In my own head I have unpacked your response. Any experts please can you correct mistakes I may be making here. It appears to me that:
Hugo does not require an _index.md
file to generate a list page. It will do so based on the existence of any content file in a subdirectory of content/
. In fact it seems that only since version 0.18 has it been possible to affect the generation of “list pages” by creating an _index.md
, and this goes with the slogan “everything is a page”.
Further experimentation seems to indicate that if I move the (content) file /test.md to /test/_index.md, Hugo does respect its type and layout, so I can have pretty URLs /test/ and /test/test2/, both with the layout I specify in front matter.
In the documentation I have not found an explicit statement that Hugo generates “section pages”, though at https://gohugo.io/templates/lists/#add-content-and-front-matter-to-list-pages it does say:
Since v0.18, everything in Hugo is a Page
. This means list pages and the homepage can have associated content files (i.e. _index.md
) that contain page metadata (i.e., front matter) and content.
Fortunately for me, the additional statement just below:
It is important to note that all _index.md
content files will render according to a list template and not according to a single page template.
This evidently is obsolete, and has changed with more recent work for Hugo to respect type
and layout
.
OK? Corrections?