Layout-specific render hook?

I have an alternate Layout for pages, where I can specify layout in the front-matter and it uses its own template instead of single.html. Now, I want a render hook for headings that will only apply if this layout is being used.

Looking at the fine manual, it seems I can have render hooks specific to types, sections, output formats, and languages–but not layouts? Must I create a render hook that is always used, check .Page.Params.layout, and reproduce the default behavior if my layout is not being used?

Option 1

Specify layout in front matter, and include a conditional against .Page.Params.layout in the render hook.

Option 2

Specify a new type (e.g., foo) in front matter, move your custom single.html to layouts/foo/single.html, then create a new render hook in layouts/foo.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.