summaryrefslogtreecommitdiffstats
path: root/output
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-06-02 18:08:17 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-06-02 19:02:10 +0200
commitf8c67f93e123a7ac1c9c7af8000cc9d1fd978cd7 (patch)
tree6de6c2f34f79289b8be7263b29ded2b0557bb73b /output
parent3d9235e8fcf31553c0c0f313d3264f12438749ea (diff)
Allow hook template per section/type
Fixes #7349
Diffstat (limited to 'output')
-rw-r--r--output/layout.go15
-rw-r--r--output/layout_test.go3
2 files changed, 9 insertions, 9 deletions
diff --git a/output/layout.go b/output/layout.go
index e59404684..09ac7b2f6 100644
--- a/output/layout.go
+++ b/output/layout.go
@@ -134,15 +134,16 @@ func resolvePageTemplate(d LayoutDescriptor, f Format) []string {
b := &layoutBuilder{d: d, f: f}
+ if !d.RenderingHook && d.Layout != "" {
+ b.addLayoutVariations(d.Layout)
+ }
+ if d.Type != "" {
+ b.addTypeVariations(d.Type)
+ }
+
if d.RenderingHook {
b.addLayoutVariations(d.Kind)
- } else {
- if d.Layout != "" {
- b.addLayoutVariations(d.Layout)
- }
- if d.Type != "" {
- b.addTypeVariations(d.Type)
- }
+ b.addSectionType()
}
switch d.Kind {
diff --git a/output/layout_test.go b/output/layout_test.go
index 8f26bb6c4..d5b6c7bca 100644
--- a/output/layout_test.go
+++ b/output/layout_test.go
@@ -128,9 +128,8 @@ func TestLayout(t *testing.T) {
[]string{"404.html.html", "404.html"}, 2},
{"404, HTML baseof", LayoutDescriptor{Kind: "404", Baseof: true}, "", htmlFormat,
[]string{"404-baseof.html.html", "baseof.html.html", "404-baseof.html", "baseof.html", "_default/404-baseof.html.html", "_default/baseof.html.html", "_default/404-baseof.html", "_default/baseof.html"}, 8},
- // We may add type support ... later.
{"Content hook", LayoutDescriptor{Kind: "render-link", RenderingHook: true, Layout: "mylayout", Section: "blog"}, "", ampType,
- []string{"_default/_markup/render-link.amp.html", "_default/_markup/render-link.html"}, 2},
+ []string{"blog/_markup/render-link.amp.html", "blog/_markup/render-link.html", "_default/_markup/render-link.amp.html", "_default/_markup/render-link.html"}, 4},
} {
c.Run(this.name, func(c *qt.C) {
l := NewLayoutHandler()