From: Joe Mooring Date: Thu, 18 Sep 2025 16:03:15 +0000 (-0700) Subject: hugolib: Change duplicate content path warning to an info log X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=64f40731f1ccbffcdaefd38598981910a18cf0ff;p=brevno-suite%2Fhugo hugolib: Change duplicate content path warning to an info log Improves #13993 --- diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go index f72862150..9a22c3c3d 100644 --- a/hugolib/content_map_test.go +++ b/hugolib/content_map_test.go @@ -279,9 +279,9 @@ P1: {{ $p1.Title }}|{{ $p1.Params.foo }}|{{ $p1.File.Filename }}| ` for range 3 { - b := Test(t, files, TestOptWarn()) + b := Test(t, files, TestOptInfo()) - b.AssertLogContains("WARN Duplicate content path: \"/p1\"") + b.AssertLogContains("INFO Duplicate content path: \"/p1\"") // There's multiple content files sharing the same logical path and language. // This is a little arbitrary, but we have to pick one and prefer the Markdown version. diff --git a/hugolib/language_content_dir_test.go b/hugolib/language_content_dir_test.go index fdcc4cc18..27039400c 100644 --- a/hugolib/language_content_dir_test.go +++ b/hugolib/language_content_dir_test.go @@ -175,3 +175,68 @@ title: "p4 theme (nl)" b.AssertFileContent("public/de/index.html", `home (de): de: p1 (de)|p2 (en)|p3 (en)|:END`) b.AssertFileContent("public/en/index.html", `home (en): en: p1 (en)|p2 (en)|p3 (en)|:END`) } + +// Issue 13993 +func TestIssue13993(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['home','rss','section','sitemap','taxonomy','term'] +printPathWarnings = true + +defaultContentLanguage = 'en' +defaultContentLanguageInSubdir = true + +[languages.en] +contentDir = "content/en" +weight = 1 + +[languages.es] +contentDir = "content/es" +weight = 2 + +# Default content mounts + +[[module.mounts]] +source = "content/en" +target = "content" +lang = "en" + +[[module.mounts]] +source = "content/es" +target = "content" +lang = "es" + +# Populate the missing es content with en content + +[[module.mounts]] +source = "content/en" +target = "content" +lang = "es" +-- layouts/all.html -- +{{ .Title }} +-- content/en/p1.md -- +--- +title: p1 (en) +--- +-- content/en/p2.md -- +--- +title: p2 (en) +--- +-- content/es/p1.md -- +--- +title: p1 (es) +--- +` + + b := Test(t, files, TestOptInfo()) + + b.AssertFileExists("public/en/p1/index.html", true) + b.AssertFileExists("public/en/p2/index.html", true) + b.AssertFileExists("public/es/p1/index.html", true) + b.AssertFileExists("public/es/p2/index.html", true) + + b.AssertLogContains("INFO Duplicate") + b.AssertLogContains("! WARN Duplicate") +} diff --git a/hugolib/pages_capture.go b/hugolib/pages_capture.go index 37ed3c89c..91f3afae4 100644 --- a/hugolib/pages_capture.go +++ b/hugolib/pages_capture.go @@ -334,7 +334,7 @@ func (c *pagesCollector) collectDirDir(path string, root hugofs.FileMetaInfo, in baseLang := hstrings.Strings2{pi.Base(), meta.Lang} if fi2, ok := seen[baseLang]; ok { if c.h.Configs.Base.PrintPathWarnings && !c.h.isRebuild() { - c.logger.Warnf("Duplicate content path: %q file: %q file: %q", pi.Base(), fi2.Meta().Filename, meta.Filename) + c.logger.Infof("Duplicate content path: %q file: %q file: %q", pi.Base(), fi2.Meta().Filename, meta.Filename) } continue }