Don't panic on empty yaml config params

Fixes #11047
This commit is contained in:
Bjørn Erik Pedersen
2023-05-30 11:38:29 +02:00
parent 3f497d496f
commit a7d6b1413f
2 changed files with 25 additions and 2 deletions

View File

@@ -1066,3 +1066,26 @@ LanguageCode: {{ .Site.LanguageCode }}|{{ site.Language.LanguageCode }}|
b.AssertFileContent("public/index.html", "LanguageCode: en-US|en-US|")
}
// Issue 11047
func TestConfigYamlNil(t *testing.T) {
t.Parallel()
files := `
-- hugo.yaml --
params:
-- layouts/index.html --
Foo: {{ site.Params.foo }}|
`
b := NewIntegrationTestBuilder(
IntegrationTestConfig{
T: t,
TxtarString: files,
},
).Build()
b.AssertFileContent("public/index.html", "Foo: |")
}