summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Richter <richtera@users.noreply.github.com>2020-09-13 14:36:37 -0400
committerGitHub <noreply@github.com>2020-09-13 20:36:37 +0200
commit9df60b62f9c4e36a269f0c6e9a69bee9dc691031 (patch)
tree5f179bdfd4c20961377a4b893a6c74ea1a04ab21
parent4fad43c8bd528f1805e78c50cd2e33822351c183 (diff)
Print layout name if it was specified when showing missing layout file error
Fixes #7617
-rw-r--r--hugolib/site.go2
-rw-r--r--hugolib/site_render.go9
2 files changed, 8 insertions, 3 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index dad5ab538..b06d5176b 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1721,7 +1721,7 @@ func (hr hookRenderer) RenderHeading(w io.Writer, ctx hooks.HeadingContext) erro
func (s *Site) renderForTemplate(name, outputFormat string, d interface{}, w io.Writer, templ tpl.Template) (err error) {
if templ == nil {
- s.logMissingLayout(name, "", outputFormat)
+ s.logMissingLayout(name, "", "", outputFormat)
return nil
}
diff --git a/hugolib/site_render.go b/hugolib/site_render.go
index 88b5e6fb7..d9d60c2fa 100644
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -130,7 +130,7 @@ func pageRenderer(
}
if !found {
- s.logMissingLayout("", p.Kind(), p.f.Name)
+ s.logMissingLayout("", p.Layout(), p.Kind(), p.f.Name)
continue
}
@@ -148,7 +148,7 @@ func pageRenderer(
}
}
-func (s *Site) logMissingLayout(name, kind, outputFormat string) {
+func (s *Site) logMissingLayout(name, layout, kind, outputFormat string) {
log := s.Log.WARN
if name != "" && infoOnMissingLayout[name] {
log = s.Log.INFO
@@ -162,6 +162,11 @@ func (s *Site) logMissingLayout(name, kind, outputFormat string) {
args = append(args, outputFormat)
}
+ if layout != "" {
+ msg += " for layout %q"
+ args = append(args, layout)
+ }
+
if kind != "" {
msg += " for kind %q"
args = append(args, kind)