Support, but warn, about top level language custom params

Updates #10947
This commit is contained in:
Bjørn Erik Pedersen 2023-05-17 16:29:06 +02:00
parent 05542130ba
commit 7ce033a89d
4 changed files with 103 additions and 16 deletions

View file

@ -778,6 +778,43 @@ Home.
}
func TestConfigParamSetOnLanguageLevel(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT"]
[languages]
[languages.en]
title = "English Title"
thisIsAParam = "thisIsAParamValue"
[languages.en.params]
myparam = "enParamValue"
[languages.sv]
title = "Svensk Title"
[languages.sv.params]
myparam = "svParamValue"
-- layouts/index.html --
MyParam: {{ site.Params.myparam }}
ThisIsAParam: {{ site.Params.thisIsAParam }}
`
b, err := NewIntegrationTestBuilder(
IntegrationTestConfig{
T: t,
TxtarString: files,
},
).BuildE()
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", `
MyParam: enParamValue
ThisIsAParam: thisIsAParamValue
`)
}
func TestReproCommentsIn10947(t *testing.T) {
t.Parallel()
@ -817,7 +854,9 @@ title: "My Swedish Section"
},
).Build()
b.Assert(b.H.Log.LogCounters().WarnCounter.Count(), qt.Equals, uint64(2))
{
b.Assert(b.H.Log.LogCounters().WarnCounter.Count(), qt.Equals, uint64(2))
}
b.AssertFileContent("public/index.html", `
AllPages: 4|
Sections: true|