From: Bjørn Erik Pedersen Date: Tue, 26 Mar 2019 09:28:02 +0000 (+0100) Subject: hugolib: Add a test for home page with no title X-Git-Tag: v0.55.0~38 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bceda1b288f0ad6282916826b596cb1fe19983bb;p=brevno-suite%2Fhugo hugolib: Add a test for home page with no title See #5784 --- diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 1e362e0d..f243740c 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -1174,6 +1174,20 @@ func TestPageWithZeroFile(t *testing.T) { WithTemplatesAdded("index.html", "{{ .File.Filename }}{{ with .File }}{{ .Dir }}{{ end }}").Build(BuildCfg{}) } +func TestHomePageWithNoTitle(t *testing.T) { + b := newTestSitesBuilder(t).WithSimpleConfigFile(). + WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|") + b.WithContent("_index.md", `--- +description: "No title for you!" +--- + +Content. +`) + + b.Build(BuildCfg{}) + b.AssertFileContent("public/index.html", "Title||") +} + func TestShouldBuild(t *testing.T) { t.Parallel() var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)