From 7ce033a89d411036e40dbb42325e30e12248bda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 17 May 2023 16:29:06 +0200 Subject: Support, but warn, about top level language custom params Updates #10947 --- hugolib/config_test.go | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'hugolib') 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| -- cgit v1.2.3