From 7888ac585c7dedce6423104c071c9e086c6d49c4 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 29 Dec 2024 16:44:13 -0500 Subject: [PATCH] config/allconfig: Fix slice of language configs Fixes #13201 --- config/allconfig/allconfig.go | 1 - .../allconfig/allconfig_integration_test.go | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go index 5fe6edcd16f..4d65d5f2bab 100644 --- a/config/allconfig/allconfig.go +++ b/config/allconfig/allconfig.go @@ -751,7 +751,6 @@ func (c *Configs) Init() error { var languages langs.Languages defaultContentLanguage := c.Base.DefaultContentLanguage for k, v := range c.LanguageConfigMap { - c.LanguageConfigSlice = append(c.LanguageConfigSlice, v) languageConf := v.Languages[k] language, err := langs.NewLanguage(k, defaultContentLanguage, v.TimeZone, languageConf) if err != nil { diff --git a/config/allconfig/allconfig_integration_test.go b/config/allconfig/allconfig_integration_test.go index 43d5261d098..162a36cdb89 100644 --- a/config/allconfig/allconfig_integration_test.go +++ b/config/allconfig/allconfig_integration_test.go @@ -193,3 +193,25 @@ x b.Assert(err, qt.IsNotNil) b.Assert(err.Error(), qt.Contains, `failed to create config: unknown output format "foo" for kind "home"`) } + +// Issue 13201 +func TestLanguageConfigSlice(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] +[languages.en] +title = 'TITLE_EN' +weight = 2 +[languages.de] +title = 'TITLE_DE' +weight = 1 +[languages.fr] +title = 'TITLE_FR' +weight = 3 +` + + b := hugolib.Test(t, files) + b.Assert(b.H.Configs.LanguageConfigSlice[0].Title, qt.Equals, `TITLE_DE`) +}