mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hubolib: Revert to .Type = "page" when empty
This was changed with good intentions in 0.63.0. This behaviour was not documented, but it was of course in use. This commit rolls back to how it behaved before: For `Page.Type` you will get: * `type` from front matter if set. * `.Section` * If none of the above returns anything, return "page" Fixes #6805
This commit is contained in:
@@ -291,12 +291,18 @@ func (p *pageMeta) Title() string {
|
||||
return p.title
|
||||
}
|
||||
|
||||
const defaultContentType = "page"
|
||||
|
||||
func (p *pageMeta) Type() string {
|
||||
if p.contentType != "" {
|
||||
return p.contentType
|
||||
}
|
||||
|
||||
return p.Section()
|
||||
if sect := p.Section(); sect != "" {
|
||||
return sect
|
||||
}
|
||||
|
||||
return defaultContentType
|
||||
}
|
||||
|
||||
func (p *pageMeta) Weight() int {
|
||||
|
Reference in New Issue
Block a user