mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
hugolib: Add capitalizeListTitles config option
Whether to capitalize automatic page titles, applicable to section, taxonomy, and term pages. Default is true. Closes #9793 Closes #12115
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
ea0ba9751d
commit
36bf3cb98c
@@ -446,7 +446,7 @@ title: "My Title"
|
||||
params:
|
||||
build: "My Build"
|
||||
---
|
||||
´
|
||||
´
|
||||
|
||||
`
|
||||
}
|
||||
@@ -746,15 +746,26 @@ func (p *pageMeta) applyDefaultValues() error {
|
||||
if p.s.conf.PluralizeListTitles {
|
||||
sectionName = flect.Pluralize(sectionName)
|
||||
}
|
||||
p.pageConfig.Title = p.s.conf.C.CreateTitle(sectionName)
|
||||
if p.s.conf.CapitalizeListTitles {
|
||||
sectionName = p.s.conf.C.CreateTitle(sectionName)
|
||||
}
|
||||
p.pageConfig.Title = sectionName
|
||||
case kinds.KindTerm:
|
||||
if p.term != "" {
|
||||
p.pageConfig.Title = p.s.conf.C.CreateTitle(p.term)
|
||||
if p.s.conf.CapitalizeListTitles {
|
||||
p.pageConfig.Title = p.s.conf.C.CreateTitle(p.term)
|
||||
} else {
|
||||
p.pageConfig.Title = p.term
|
||||
}
|
||||
} else {
|
||||
panic("term not set")
|
||||
}
|
||||
case kinds.KindTaxonomy:
|
||||
p.pageConfig.Title = strings.Replace(p.s.conf.C.CreateTitle(p.pathInfo.Unnormalized().BaseNameNoIdentifier()), "-", " ", -1)
|
||||
if p.s.conf.CapitalizeListTitles {
|
||||
p.pageConfig.Title = strings.Replace(p.s.conf.C.CreateTitle(p.pathInfo.Unnormalized().BaseNameNoIdentifier()), "-", " ", -1)
|
||||
} else {
|
||||
p.pageConfig.Title = strings.Replace(p.pathInfo.Unnormalized().BaseNameNoIdentifier(), "-", " ", -1)
|
||||
}
|
||||
case kinds.KindStatus404:
|
||||
p.pageConfig.Title = "404 Page not found"
|
||||
}
|
||||
|
Reference in New Issue
Block a user