Is it possible to specify the template that Hugo should use in order to render
_index.md? (Ideally I would like to simply change
layout, which does not work – see below.)
The main use case for this would be sites that consist mostly of single pages (rendered using
layouts/_default/single.html), where the home page should have the same layout as the rest of the site.
Currently this does not seem to be possible without copying the template
index.html, since home pages are always considered list pages.
What’s the most elegant solution here?
~/hugo-temp % tree --dirsfirst content content ├── blog │ ├── _index.md │ ├── bazqux.md │ ├── foobar.md │ └── foobaz.md ├── _index.md ├── bar.md ├── baz.md └── foo.md
In this case, I would like to render
content/foo.md using the same template, whereas
content/blog/_index.md should be rendered using the list template.
- using dummy partials (see for example Single template for all content): does not avoid the issue, but reduces non-DRYness
- using blocks (see for example Is it necessary to have separate templates for homepage and other on a simple site?): does not avoid the issue, but reduces non-DRYness
layoutin the preamble: would have to be done for all
listpages are not affected by this
- symlinking list.html to single.html: does not work because “Symbolic links for directories not supported”
(This thread evolved from my question here: Trying to understand spurious(?) “home page is blank” warnings.)