diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-28 10:01:44 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-28 12:33:33 +0200 |
commit | 79639c981cf69193fb21d97773d928c089714750 (patch) | |
tree | 8a2965fe1b9fdb5c8db812d14cb5e2a58a090bba /hugolib/config_test.go | |
parent | 9b313cec1bb6ee9b7f7e751a721e65fcdc35691b (diff) |
Fix output formats and media type per language config regression
Fixes #11159
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r-- | hugolib/config_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 56a03c6df..f87d8b936 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -1144,6 +1144,48 @@ LanguageCode: {{ .Site.LanguageCode }}|{{ site.Language.LanguageCode }}| } +// See #11159 +func TestConfigOutputFormatsPerLanguage(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +[languages] +[languages.en] +title = "English Title" +[languages.sv] +title = "Swedish Title" +[languages.sv.outputFormats.html] +path = "foo" +[languages.sv.mediatypes."text/html"] +suffixes = ["bar"] + +-- layouts/index.html -- +Home. + + +` + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).Build() + + b.AssertFileContent("public/index.html", "Home.") + + enConfig := b.H.Sites[0].conf + m, _ := enConfig.MediaTypes.Config.GetByType("text/html") + b.Assert(m.Suffixes(), qt.DeepEquals, []string{"html"}) + + svConfig := b.H.Sites[1].conf + f, _ := svConfig.OutputFormats.Config.GetByName("html") + b.Assert(f.Path, qt.Equals, "foo") + m, _ = svConfig.MediaTypes.Config.GetByType("text/html") + b.Assert(m.Suffixes(), qt.DeepEquals, []string{"bar"}) + +} + func TestConfigMiscPanics(t *testing.T) { t.Parallel() |