config/allconfig: Fix slice of language configs - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 7888ac585c7dedce6423104c071c9e086c6d49c4
DIR parent eb1dbe070923f75332d22b56b44a921734e19f0d
HTML Author: Joe Mooring <joe.mooring@veriphor.com>
Date: Sun, 29 Dec 2024 16:44:13 -0500
config/allconfig: Fix slice of language configs
Fixes #13201
Diffstat:
M config/allconfig/allconfig.go | 1 -
M config/allconfig/allconfig_integra… | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
---
DIR diff --git 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 {
DIR diff --git 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`)
+}