"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/tpl"
"github.com/gohugoio/hugo/watcher"
- "github.com/spf13/afero"
"github.com/spf13/fsync"
"golang.org/x/sync/errgroup"
"golang.org/x/sync/semaphore"
return err
}
- if c.r.printPathWarnings {
- hugofs.WalkFilesystems(h.Fs.PublishDir, func(fs afero.Fs) bool {
- if dfs, ok := fs.(hugofs.DuplicatesReporter); ok {
- dupes := dfs.ReportDuplicates()
- if dupes != "" {
- c.r.logger.Warnln("Duplicate target paths:", dupes)
- }
- }
- return false
- })
- }
-
if c.r.printUnusedTemplates {
unusedTemplates := h.Tmpl().(tpl.UnusedTemplatesProvider).UnusedTemplates()
for _, unusedTemplate := range unusedTemplates {
if err := h.render(infol, conf); err != nil {
h.SendError(fmt.Errorf("render: %w", err))
}
+
+ if h.Configs.Base.LogPathWarnings {
+ // We need to do this before any post processing, as that may write to the same files twice
+ // and create false positives.
+ hugofs.WalkFilesystems(h.Fs.PublishDir, func(fs afero.Fs) bool {
+ if dfs, ok := fs.(hugofs.DuplicatesReporter); ok {
+ dupes := dfs.ReportDuplicates()
+ if dupes != "" {
+ h.Log.Warnln("Duplicate target paths:", dupes)
+ }
+ }
+ return false
+ })
+ }
+
if err := h.postProcess(infol); err != nil {
h.SendError(fmt.Errorf("postProcess: %w", err))
}
--- /dev/null
+hugo --printPathWarnings
+
+! stdout 'Duplicate'
+
+-- hugo.toml --
+-- assets/css/styles.css --
+body {
+ background-color: #000;
+}
+-- content/p1.md --
+-- content/p2.md --
+-- content/p3.md --
+-- layouts/index.html --
+Home.
+-- layouts/_default/single.html --
+{{ $css := resources.Get "css/styles.css" }}
+{{ $css := $css | minify | fingerprint | resources.PostProcess }}
+CSS: {{ $css.RelPermalink }}
+{{ .Title }}
+
--- /dev/null
+hugo --printPathWarnings
+
+stdout 'Duplicate'
+
+-- hugo.toml --
+-- assets/css/styles.css --
+body {
+ background-color: #000;
+}
+-- content/p1.md --
+---
+url: /p1/
+---
+-- content/p2.md --
+---
+url: /p1/
+---
+-- content/p3.md --
+---
+url: /p1/
+---
+-- layouts/index.html --
+Home.
+-- layouts/_default/single.html --
+Single.
+