Skip to content

Potentially false duplicate path warning #13993

@jmooring

Description

@jmooring

The test below passes with v0.145.0 and earlier, and fails with v0.146.0 and later:

// 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, TestOptWarn())

	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("! Duplicate") // fails
}

The above emits this unexpected warning:

WARN Duplicate content path: "/p1" file: "/content/es/p1.md" file: "/content/en/p1.md"

Reference: https://discourse.gohugo.io/t/55931

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions