From: Bjørn Erik Pedersen Date: Sat, 20 Dec 2025 12:58:50 +0000 (+0100) Subject: Revert deprecation logging for contentDir per language X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=168bf17e7042a4df98742d21354205b8a48641a5;p=brevno-suite%2Fhugo Revert deprecation logging for contentDir per language It was accidentally introduced because we compile it to file mounts, and `lang` on file mounts is deprecated in favor of `sites.matrix`. But contentDir per language is something we have had for a long time, and is to useful too to deprecate. Fixes #14287 --- diff --git a/hugofs/hugofs_integration_test.go b/hugofs/hugofs_integration_test.go index e9592a4e1..4988f2d8c 100644 --- a/hugofs/hugofs_integration_test.go +++ b/hugofs/hugofs_integration_test.go @@ -118,3 +118,32 @@ product2/tutorials/tutorial1/index.html product2/tutorials/tutorial2/index.html `) } + +func TestContentDirPerLangNoDeprecationPleaseIssue14287(t *testing.T) { + files := ` +-- hugo.toml -- +defaultContentLanguage = "en" +defaultContentLanguageInSubdir = true +[languages] +[languages.en] +contentDir = "content/en" +[languages.fr] +contentDir = "content/fr" +-- content/en/page.md -- +--- +title: "English Page" +--- +-- content/fr/page.md -- +--- +title: "Page Française" +--- +-- layouts/all.html -- +Title: {{ .Title }}| +-- +` + b := hugolib.Test(t, files, hugolib.TestOptInfo()) + + b.AssertFileContent("public/en/page/index.html", "Title: English Page|") + b.AssertFileContent("public/fr/page/index.html", "Title: Page Française|") + b.AssertLogContains("! deprecated") +} diff --git a/modules/config.go b/modules/config.go index adc330902..71f85917b 100644 --- a/modules/config.go +++ b/modules/config.go @@ -157,7 +157,7 @@ func ApplyProjectConfigDefaults(logger logg.Logger, mod Module, cfgs ...config.A } if dir != "" { - mnt := Mount{Lang: lang, Source: dir, Target: component} + mnt := Mount{Source: dir, Target: component, Sites: sites} if err := mnt.init(logger); err != nil { return fmt.Errorf("failed to init mount %q %d: %w", lang, i, err) } @@ -501,6 +501,7 @@ func (m *Mount) init(logger logg.Logger) error { m.Lang = "" hugo.DeprecateWithLogger("module.mounts.lang", "Replaced by the more powerful 'sites.matrix' setting, see https://gohugo.io/configuration/module/#mounts", "v0.153.0", logger) + } m.Sites.Matrix.Languages = hstrings.UniqueStringsReuse(m.Sites.Matrix.Languages)