diff --git a/hugofs/walk.go b/hugofs/walk.go index 44d58f06085..c02d366713f 100644 --- a/hugofs/walk.go +++ b/hugofs/walk.go @@ -270,7 +270,7 @@ func (w *Walkway) walk(path string, info FileMetaInfo, dirEntries []FileMetaInfo meta.Path = normalizeFilename(pathMeta) meta.PathWalk = pathn - if fim.IsDir() && w.isSeen(meta.Filename) { + if fim.IsDir() && meta.IsSymlink && w.isSeen(meta.Filename) { // Prevent infinite recursion // Possible cyclic reference meta.SkipDir = true diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go index 46423043750..eb6b7433b5e 100644 --- a/hugolib/hugo_modules_test.go +++ b/hugolib/hugo_modules_test.go @@ -1134,3 +1134,39 @@ P1: {{ $p1.Title }}|{{ $p1.RelPermalink }}|Filename: {{ $p1.File.Filename }} b.AssertFileContent("public/index.html", "P1: Abs|/p1/", "Filename: "+contentFilename) } + +// Issue 9426 +func TestMountSameSource(t *testing.T) { + config := `baseURL = 'https://example.org/' +languageCode = 'en-us' +title = 'Hugo GitHub Issue #9426' + +disableKinds = ['RSS','sitemap','taxonomy','term'] + +[[module.mounts]] +source = "content" +target = "content" + +[[module.mounts]] +source = "extra-content" +target = "content/resources-a" + +[[module.mounts]] +source = "extra-content" +target = "content/resources-b" +` + b := newTestSitesBuilder(t).WithConfigFile("toml", config) + + b.WithContent("p1.md", "") + + b.WithSourceFile( + "extra-content/_index.md", "", + "extra-content/subdir/_index.md", "", + "extra-content/subdir/about.md", "", + ) + + b.Build(BuildCfg{}) + + b.AssertFileContent("public/resources-a/subdir/about/index.html", "Single") + b.AssertFileContent("public/resources-b/subdir/about/index.html", "Single") +}