hugolib: Add a test for home page with no title - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit bceda1b288f0ad6282916826b596cb1fe19983bb
DIR parent 4dae52af680e6ff2c8cdeb4ce1f219330b27001c
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Tue, 26 Mar 2019 10:28:02 +0100
hugolib: Add a test for home page with no title
See #5784
Diffstat:
M hugolib/page_test.go | 14 ++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)
---
DIR diff --git 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)