summaryrefslogtreecommitdiffstats
path: root/hugolib/page__meta.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-01-26 15:53:42 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-01-27 12:33:33 +0100
commite8831a056b5664c3a066b9a9c4c618d1f483b10c (patch)
treebab3ba09114162976d2ac296f576406f4f2a0dab /hugolib/page__meta.go
parent74b6c4e5ff5ee16f0e6b352a26c1e58b90a25dc6 (diff)
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
Diffstat (limited to 'hugolib/page__meta.go')
-rw-r--r--hugolib/page__meta.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go
index caffbe736..60952c831 100644
--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -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 {