ref: 9bc6187b8337c4a370bd3f21130a764d9ef6f7b3
parent: 10bb614a70db22c01c9a52054ede35bc0a01aa24
author: Bjørn Erik Pedersen <[email protected]>
date: Tue Mar 26 10:33:09 EDT 2019
hugolib: Do not fall back to site title if not set in content file See #5784
--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -545,7 +545,7 @@
}
}
- if p.title == "" {
+ if p.title == "" && p.f.IsZero() {
switch p.Kind() {
case page.KindHome:
p.title = p.s.Info.title
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1175,8 +1175,10 @@
}
func TestHomePageWithNoTitle(t *testing.T) {
- b := newTestSitesBuilder(t).WithSimpleConfigFile().
- WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|")
+ b := newTestSitesBuilder(t).WithConfigFile("toml", `
+title = "Site Title"
+`)
+ b.WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|")
b.WithContent("_index.md", `---
description: "No title for you!"
---