In relation to the new template system, this has been discussed before, but I'd like to revisit it.
Consider this project structure:
content/
└── p1.md
layouts/
├── page/
│ └── page.html
└── page.html
When the page type is explicitly set to "page" in front matter, Hugo renders p1.md using layouts/page/page.html as expected.
However, when the page type is implicitly set to "page" Hugo renders p1.md using layouts/page.html instead.
Without digging into the details, I suspect that this method has no impact on template selection:
|
const defaultContentType = "page" |
|
|
|
func (p *pageMeta) Type() string { |
|
if p.pageConfig.Type != "" { |
|
return p.pageConfig.Type |
|
} |
|
|
|
if sect := p.Section(); sect != "" { |
|
return sect |
|
} |
|
|
|
return defaultContentType |
|
} |
Reference: https://discourse.gohugo.io/t/possible-bug-single-layout-for-pages-in-v0-147-9/55179/
In relation to the new template system, this has been discussed before, but I'd like to revisit it.
Consider this project structure:
When the page
typeis explicitly set to "page" in front matter, Hugo rendersp1.mdusinglayouts/page/page.htmlas expected.However, when the page
typeis implicitly set to "page" Hugo rendersp1.mdusinglayouts/page.htmlinstead.Without digging into the details, I suspect that this method has no impact on template selection:
hugo/hugolib/page__meta.go
Lines 226 to 238 in dd6e2c8
Reference: https://discourse.gohugo.io/t/possible-bug-single-layout-for-pages-in-v0-147-9/55179/