aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-08-05 11:00:47 +0200
committerBjørn Erik Pedersen <[email protected]>2024-08-07 18:28:23 +0200
commitc6227f1d8597f053986c13eac131ae5122a68444 (patch)
treecba7d8960a2b5b52adb1d0e361212e3beb7a5877 /hugolib
parent1781b18427134a7421ffba361e153c57b3ce2b2f (diff)
downloadhugo-c6227f1d8597f053986c13eac131ae5122a68444.tar.gz
hugo-c6227f1d8597f053986c13eac131ae5122a68444.zip
Add render hooks for inline and block passthrough snippets
Fixes #11927
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page__per_output.go5
-rw-r--r--hugolib/site.go4
2 files changed, 9 insertions, 0 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index 6dffd18a5..59ba722a8 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -476,6 +476,11 @@ func (pco *pageContentOutput) initRenderHooks() error {
layoutDescriptor.Kind = "render-image"
case hooks.HeadingRendererType:
layoutDescriptor.Kind = "render-heading"
+ case hooks.PassthroughRendererType:
+ layoutDescriptor.Kind = "render-passthrough"
+ if id != nil {
+ layoutDescriptor.KindVariants = id.(string)
+ }
case hooks.CodeBlockRendererType:
layoutDescriptor.Kind = "render-codeblock"
if id != nil {
diff --git a/hugolib/site.go b/hugolib/site.go
index 2113c4f20..0b089767a 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -915,6 +915,10 @@ func (hr hookRendererTemplate) RenderCodeblock(cctx context.Context, w hugio.Fle
return hr.templateHandler.ExecuteWithContext(cctx, hr.templ, w, ctx)
}
+func (hr hookRendererTemplate) RenderPassthrough(cctx context.Context, w io.Writer, ctx hooks.PassthroughContext) error {
+ return hr.templateHandler.ExecuteWithContext(cctx, hr.templ, w, ctx)
+}
+
func (hr hookRendererTemplate) ResolvePosition(ctx any) text.Position {
return hr.resolvePosition(ctx)
}