tpl/collections: Fix and deprecate echoParams

Fixes #11498
This commit is contained in:
Joe Mooring
2023-09-26 13:49:44 -07:00
committed by Bjørn Erik Pedersen
parent d234a963eb
commit 75f56b4ce6
2 changed files with 40 additions and 1 deletions

View File

@@ -231,3 +231,37 @@ foo: bc
).Build()
b.AssertFileContent("public/index.html", "<ul><li>P1</li><li>P2</li></ul>")
}
// Issue #11498
func TestEchoParams(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
[params.footer]
string = 'foo'
int = 42
float = 3.1415
boolt = true
boolf = false
-- layouts/index.html --
{{ echoParam .Site.Params.footer "string" }}
{{ echoParam .Site.Params.footer "int" }}
{{ echoParam .Site.Params.footer "float" }}
{{ echoParam .Site.Params.footer "boolt" }}
{{ echoParam .Site.Params.footer "boolf" }}
`
b := hugolib.NewIntegrationTestBuilder(
hugolib.IntegrationTestConfig{
T: t,
TxtarString: files,
},
).Build()
b.AssertFileContent("public/index.html",
"foo",
"42",
"3.1415",
"true",
"false",
)
}