mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
9ea7103db7
commit
171836cdfa
2 changed files with 35 additions and 5 deletions
|
@ -114,3 +114,36 @@ func TestRenderStringBadMarkupOpt(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #11547
|
||||||
|
func TestTitleCaseStyleWithAutomaticSectionPages(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- config.toml --
|
||||||
|
titleCaseStyle = 'none'
|
||||||
|
-- content/books/book-1.md --
|
||||||
|
---
|
||||||
|
title: Book 1
|
||||||
|
tags: [fiction]
|
||||||
|
---
|
||||||
|
-- content/films/_index.md --
|
||||||
|
---
|
||||||
|
title: Films
|
||||||
|
---
|
||||||
|
-- layouts/index.html --
|
||||||
|
{{ (site.GetPage "/tags").Title }}
|
||||||
|
{{ (site.GetPage "/tags/fiction").Title }}
|
||||||
|
{{ (site.GetPage "/books").Title }}
|
||||||
|
{{ (site.GetPage "/films").Title }}
|
||||||
|
`
|
||||||
|
|
||||||
|
b := hugolib.NewIntegrationTestBuilder(
|
||||||
|
hugolib.IntegrationTestConfig{
|
||||||
|
T: t,
|
||||||
|
TxtarString: files,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
b.Build()
|
||||||
|
b.AssertFileContent("public/index.html", "tags\nfiction\nbooks\nFilms")
|
||||||
|
}
|
||||||
|
|
|
@ -690,13 +690,10 @@ func (p *pageMeta) applyDefaultValues(n *contentNode) error {
|
||||||
} else {
|
} else {
|
||||||
sectionName = p.sections[0]
|
sectionName = p.sections[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionName = helpers.FirstUpper(sectionName)
|
|
||||||
if p.s.conf.PluralizeListTitles {
|
if p.s.conf.PluralizeListTitles {
|
||||||
p.title = flect.Pluralize(sectionName)
|
sectionName = flect.Pluralize(sectionName)
|
||||||
} else {
|
|
||||||
p.title = sectionName
|
|
||||||
}
|
}
|
||||||
|
p.title = p.s.conf.C.CreateTitle(sectionName)
|
||||||
case kinds.KindTerm:
|
case kinds.KindTerm:
|
||||||
// TODO(bep) improve
|
// TODO(bep) improve
|
||||||
key := p.sections[len(p.sections)-1]
|
key := p.sections[len(p.sections)-1]
|
||||||
|
|
Loading…
Reference in a new issue