Skip to content
Permalink
Browse files

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

See #5784
  • Loading branch information...
bep committed Mar 26, 2019
1 parent 10bb614 commit 9bc6187b8337c4a370bd3f21130a764d9ef6f7b3
Showing with 5 additions and 3 deletions.
  1. +1 −1 hugolib/page__meta.go
  2. +4 −2 hugolib/page_test.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
@@ -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!"
---

0 comments on commit 9bc6187

Please sign in to comment.
You can’t perform that action at this time.