mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Support, but warn, about top level language custom params
Updates #10947
This commit is contained in:
parent
05542130ba
commit
7ce033a89d
4 changed files with 103 additions and 16 deletions
|
@ -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|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue