Fix same resource file published more than once

This may still happen, though, in low memory situations or very big sites, but I'm not sure it's worth spending time on fixing that. Writing the same file more than once isn't harmful, the negative effect is the false path warning.
 We may find a way to detect that situation if this becomes a real problem.

Fixes #13164
This commit is contained in:
Bjørn Erik Pedersen 2024-12-26 13:47:10 +01:00
parent ec0caaec7c
commit 77824d704c
4 changed files with 48 additions and 27 deletions

View file

@ -0,0 +1,15 @@
hugo --printPathWarnings
! stderr 'Duplicate target paths'
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- assets/foo.txt --
foo
-- layouts/index.html --
A: {{ (resources.Get "foo.txt").RelPermalink }}
B: {{ (resources.GetMatch "foo.txt").RelPermalink }}
C: {{ (index (resources.Match "foo.txt") 0).RelPermalink }}
D: {{ (index (resources.ByType "text") 0).RelPermalink }}
-- layouts/unused/single.html --
{{ .Title }}