summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-17 16:29:06 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-17 22:13:29 +0200
commit7ce033a89d411036e40dbb42325e30e12248bda9 (patch)
treee0731bdb59645393c05a3cfe22c0bf90e09c14c9 /hugolib
parent05542130ba0205d3d8d14575b7e49ed42a855b9a (diff)
Support, but warn, about top level language custom params
Updates #10947
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config_test.go41
1 files changed, 40 insertions, 1 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index e27068da6..1baaf7196 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -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|