hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 9bc6187b8337c4a370bd3f21130a764d9ef6f7b3
parent 10bb614a70db22c01c9a52054ede35bc0a01aa24
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Tue, 26 Mar 2019 14:33:09 +0100

hugolib: Do not fall back to site title if not set in content file

See #5784

Diffstat:
Mhugolib/page__meta.go | 2+-
Mhugolib/page_test.go | 6++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go
@@ -545,7 +545,7 @@ func (p *pageMeta) applyDefaultValues() error {
 		}
 	}
 
-	if p.title == "" {
+	if p.title == "" && p.f.IsZero() {
 		switch p.Kind() {
 		case page.KindHome:
 			p.title = p.s.Info.title
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
@@ -1175,8 +1175,10 @@ func TestPageWithZeroFile(t *testing.T) {
 }
 
 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!"
 ---