Skip to content

Commit 168bf17

Browse files
committed
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 gohugoio#14287
1 parent 80ea90c commit 168bf17

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

‎hugofs/hugofs_integration_test.go‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,32 @@ product2/tutorials/tutorial1/index.html
118118
product2/tutorials/tutorial2/index.html
119119
`)
120120
}
121+
122+
func TestContentDirPerLangNoDeprecationPleaseIssue14287(t *testing.T) {
123+
files := `
124+
-- hugo.toml --
125+
defaultContentLanguage = "en"
126+
defaultContentLanguageInSubdir = true
127+
[languages]
128+
[languages.en]
129+
contentDir = "content/en"
130+
[languages.fr]
131+
contentDir = "content/fr"
132+
-- content/en/page.md --
133+
---
134+
title: "English Page"
135+
---
136+
-- content/fr/page.md --
137+
---
138+
title: "Page Française"
139+
---
140+
-- layouts/all.html --
141+
Title: {{ .Title }}|
142+
--
143+
`
144+
b := hugolib.Test(t, files, hugolib.TestOptInfo())
145+
146+
b.AssertFileContent("public/en/page/index.html", "Title: English Page|")
147+
b.AssertFileContent("public/fr/page/index.html", "Title: Page Française|")
148+
b.AssertLogContains("! deprecated")
149+
}

‎modules/config.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func ApplyProjectConfigDefaults(logger logg.Logger, mod Module, cfgs ...config.A
157157
}
158158

159159
if dir != "" {
160-
mnt := Mount{Lang: lang, Source: dir, Target: component}
160+
mnt := Mount{Source: dir, Target: component, Sites: sites}
161161
if err := mnt.init(logger); err != nil {
162162
return fmt.Errorf("failed to init mount %q %d: %w", lang, i, err)
163163
}
@@ -501,6 +501,7 @@ func (m *Mount) init(logger logg.Logger) error {
501501
m.Lang = ""
502502

503503
hugo.DeprecateWithLogger("module.mounts.lang", "Replaced by the more powerful 'sites.matrix' setting, see https://gohugo.io/configuration/module/#mounts", "v0.153.0", logger)
504+
504505
}
505506

506507
m.Sites.Matrix.Languages = hstrings.UniqueStringsReuse(m.Sites.Matrix.Languages)

0 commit comments

Comments
 (0)