Skip to content

Commit 7888ac5

Browse files
jmooringbep
authored andcommitted
config/allconfig: Fix slice of language configs
Fixes #13201
1 parent eb1dbe0 commit 7888ac5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

‎config/allconfig/allconfig.go

-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ func (c *Configs) Init() error {
751751
var languages langs.Languages
752752
defaultContentLanguage := c.Base.DefaultContentLanguage
753753
for k, v := range c.LanguageConfigMap {
754-
c.LanguageConfigSlice = append(c.LanguageConfigSlice, v)
755754
languageConf := v.Languages[k]
756755
language, err := langs.NewLanguage(k, defaultContentLanguage, v.TimeZone, languageConf)
757756
if err != nil {

‎config/allconfig/allconfig_integration_test.go

+22
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,25 @@ x
193193
b.Assert(err, qt.IsNotNil)
194194
b.Assert(err.Error(), qt.Contains, `failed to create config: unknown output format "foo" for kind "home"`)
195195
}
196+
197+
// Issue 13201
198+
func TestLanguageConfigSlice(t *testing.T) {
199+
t.Parallel()
200+
201+
files := `
202+
-- hugo.toml --
203+
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
204+
[languages.en]
205+
title = 'TITLE_EN'
206+
weight = 2
207+
[languages.de]
208+
title = 'TITLE_DE'
209+
weight = 1
210+
[languages.fr]
211+
title = 'TITLE_FR'
212+
weight = 3
213+
`
214+
215+
b := hugolib.Test(t, files)
216+
b.Assert(b.H.Configs.LanguageConfigSlice[0].Title, qt.Equals, `TITLE_DE`)
217+
}

0 commit comments

Comments
 (0)