Re-add --printUnusedTemplates and --printPathWarnings

And now with tests.

Updates #10953
This commit is contained in:
Bjørn Erik Pedersen 2023-05-19 09:55:08 +02:00
parent e4e0313c80
commit d6197a41fa
4 changed files with 59 additions and 7 deletions

View file

@ -0,0 +1,17 @@
hugo --printPathWarnings
stdout 'Duplicate target paths: .index.html \(2\)'
-- hugo.toml --
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404", "section"]
baseURL = "https://example.org/"
-- layouts/_default/single.html --
Single.
-- layouts/index.html --
Home.
-- content/p1.md --
---
title: "P1"
url: "/"
---

View file

@ -0,0 +1,11 @@
hugo --printUnusedTemplates
stdout 'Template _default/list.html is unused'
-- hugo.toml --
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404", "section", "page"]
baseURL = "https://example.org/"
-- layouts/index.html --
Home.
-- layouts/_default/list.html --
{{ errorf "unused template: %s" .Kind }}