Skip to content

Commit 0ae04de

Browse files
committed
hugolib: Change duplicate content path warning to an info log
Improves #13993
1 parent 1140314 commit 0ae04de

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

hugolib/language_content_dir_test.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,68 @@ title: "p4 theme (nl)"
175175
b.AssertFileContent("public/de/index.html", `home (de): de: p1 (de)|p2 (en)|p3 (en)|:END`)
176176
b.AssertFileContent("public/en/index.html", `home (en): en: p1 (en)|p2 (en)|p3 (en)|:END`)
177177
}
178+
179+
// Issue 13993
180+
func TestIssue13993(t *testing.T) {
181+
t.Parallel()
182+
183+
files := `
184+
-- hugo.toml --
185+
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
186+
printPathWarnings = true
187+
188+
defaultContentLanguage = 'en'
189+
defaultContentLanguageInSubdir = true
190+
191+
[languages.en]
192+
contentDir = "content/en"
193+
weight = 1
194+
195+
[languages.es]
196+
contentDir = "content/es"
197+
weight = 2
198+
199+
# Default content mounts
200+
201+
[[module.mounts]]
202+
source = "content/en"
203+
target = "content"
204+
lang = "en"
205+
206+
[[module.mounts]]
207+
source = "content/es"
208+
target = "content"
209+
lang = "es"
210+
211+
# Populate the missing es content with en content
212+
213+
[[module.mounts]]
214+
source = "content/en"
215+
target = "content"
216+
lang = "es"
217+
-- layouts/all.html --
218+
{{ .Title }}
219+
-- content/en/p1.md --
220+
---
221+
title: p1 (en)
222+
---
223+
-- content/en/p2.md --
224+
---
225+
title: p2 (en)
226+
---
227+
-- content/es/p1.md --
228+
---
229+
title: p1 (es)
230+
---
231+
`
232+
233+
b := Test(t, files, TestOptInfo())
234+
235+
b.AssertFileExists("public/en/p1/index.html", true)
236+
b.AssertFileExists("public/en/p2/index.html", true)
237+
b.AssertFileExists("public/es/p1/index.html", true)
238+
b.AssertFileExists("public/es/p2/index.html", true)
239+
240+
b.AssertLogContains("INFO Duplicate")
241+
b.AssertLogContains("! WARN Duplicate")
242+
}

hugolib/pages_capture.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func (c *pagesCollector) collectDirDir(path string, root hugofs.FileMetaInfo, in
334334
baseLang := hstrings.Strings2{pi.Base(), meta.Lang}
335335
if fi2, ok := seen[baseLang]; ok {
336336
if c.h.Configs.Base.PrintPathWarnings && !c.h.isRebuild() {
337-
c.logger.Warnf("Duplicate content path: %q file: %q file: %q", pi.Base(), fi2.Meta().Filename, meta.Filename)
337+
c.logger.Infof("Duplicate content path: %q file: %q file: %q", pi.Base(), fi2.Meta().Filename, meta.Filename)
338338
}
339339
continue
340340
}

0 commit comments

Comments
 (0)