mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Do not fall back to site title if not set in content file
See #5784
This commit is contained in:
parent
10bb614a70
commit
9bc6187b83
2 changed files with 5 additions and 3 deletions
|
@ -545,7 +545,7 @@ func (p *pageMeta) applyDefaultValues() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.title == "" {
|
if p.title == "" && p.f.IsZero() {
|
||||||
switch p.Kind() {
|
switch p.Kind() {
|
||||||
case page.KindHome:
|
case page.KindHome:
|
||||||
p.title = p.s.Info.title
|
p.title = p.s.Info.title
|
||||||
|
|
|
@ -1175,8 +1175,10 @@ func TestPageWithZeroFile(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHomePageWithNoTitle(t *testing.T) {
|
func TestHomePageWithNoTitle(t *testing.T) {
|
||||||
b := newTestSitesBuilder(t).WithSimpleConfigFile().
|
b := newTestSitesBuilder(t).WithConfigFile("toml", `
|
||||||
WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|")
|
title = "Site Title"
|
||||||
|
`)
|
||||||
|
b.WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|")
|
||||||
b.WithContent("_index.md", `---
|
b.WithContent("_index.md", `---
|
||||||
description: "No title for you!"
|
description: "No title for you!"
|
||||||
---
|
---
|
||||||
|
|
Loading…
Reference in a new issue