And now finally fix the 404 templates

Fixes #6795
This commit is contained in:
Bjørn Erik Pedersen
2020-01-27 12:30:31 +01:00
parent 8df5d76e70
commit 74b6c4e5ff
3 changed files with 21 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ type LayoutDescriptor struct {
}
func (d LayoutDescriptor) isList() bool {
return !d.RenderingHook && d.Kind != "page"
return !d.RenderingHook && d.Kind != "page" && d.Kind != "404"
}
// LayoutHandler calculates the layout template to use to render a given output type.
@@ -173,7 +173,9 @@ func resolvePageTemplate(d LayoutDescriptor, f Format) []string {
b.addTypeVariations("taxonomy")
b.addSectionType()
b.addLayoutVariations("terms")
case "404":
b.addLayoutVariations("404")
b.addTypeVariations("")
}
isRSS := f.Name == RSSFormat.Name
@@ -182,8 +184,10 @@ func resolvePageTemplate(d LayoutDescriptor, f Format) []string {
b.addLayoutVariations("")
}
// All have _default in their lookup path
b.addTypeVariations("_default")
if d.Baseof || d.Kind != "404" {
// Most have _default in their lookup path
b.addTypeVariations("_default")
}
if d.isList() {
// Add the common list type