diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-05-17 09:59:57 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-05-17 22:13:29 +0200 |
commit | 5d857165fed4649c3aa639a1555a15b8b1c75bab (patch) | |
tree | 9eafd7d8b85ec4c9bc9a16c83172c3a2b1d57e41 /hugolib/config_test.go | |
parent | 0106cf1a6db73f76b7f26744fcee6ce7f41cdf07 (diff) |
Deprecate site.Language.Params and some other fixes
Updates #10947
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r-- | hugolib/config_test.go | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index aa7785f92..93060134d 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -742,19 +742,35 @@ themeconfigdirparam: {{ site.Params.themeconfigdirparam }} } -// TODO(beo) find a better place for this. func TestReproCommentsIn10947(t *testing.T) { t.Parallel() files := ` -- hugo.toml -- baseURL = "https://example.com" --- content/mysection/_index.md -- +disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT"] +[languages] +[languages.en] +title = "English Title" +[languages.en.params] +myparam = "enParamValue" +[languages.sv] +title = "Svensk Title" +[languages.sv.params] +myparam = "svParamValue" +-- content/mysection/_index.en.md -- +--- +title: "My English Section" --- -title: "My Section" +-- content/mysection/_index.sv.md -- +--- +title: "My Swedish Section" --- -- layouts/index.html -- -Sections: {{ if site.Sections }}true{{ end }}| +{{ range $i, $e := (slice site .Site) }} +{{ $i }}|AllPages: {{ len .AllPages }}|Sections: {{ if .Sections }}true{{ end }}| Author: {{ .Authors }}|BuildDrafts: {{ .BuildDrafts }}|IsMultiLingual: {{ .IsMultiLingual }}|Param: {{ .Language.Params.myparam }}| +{{ end }} + ` @@ -765,6 +781,18 @@ Sections: {{ if site.Sections }}true{{ end }}| }, ).Build() - b.AssertFileContent("public/index.html", "Sections: true|") + b.Assert(b.H.Log.LogCounters().WarnCounter.Count(), qt.Equals, uint64(2)) + b.AssertFileContent("public/index.html", ` +AllPages: 4| +Sections: true| +Param: enParamValue +Param: enParamValue +IsMultiLingual: true +`) + + b.AssertFileContent("public/sv/index.html", ` +Param: svParamValue + +`) } |