From 5a957bc745efa6b55e85dc5027b65ec82a50c646 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Sun, 29 Jun 2025 16:18:37 -0500 Subject: [PATCH] Fix __hugo_ctx in include shortcode See posts 2 and 3: https://discourse.gohugo.io/t/weird-hugo-ctx-pid-34-inside-rendershortcodes/55176?u=bbaovanc The 4 spaces causes it to think it's an inline code block. --- layouts/_shortcodes/include.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/layouts/_shortcodes/include.html b/layouts/_shortcodes/include.html index 49272aa..15d3348 100644 --- a/layouts/_shortcodes/include.html +++ b/layouts/_shortcodes/include.html @@ -1,14 +1,14 @@ {{/* https://github.com/gohugoio/hugo/issues/13823#issuecomment-3015270202 */}} -{{ with .Get 0 }} - {{ with $.Page.GetPage . }} - {{- .RenderShortcodes }} - {{ else with $.Page.Resources.Get . }} - {{- .RenderShortcodes }} - {{ else with resources.Get . }} - {{- .Content }} - {{ else }} - {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} - {{ end }} -{{ else }} - {{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position }} -{{ end }} +{{ with .Get 0 -}} + {{ with $.Page.GetPage . -}} + {{ .RenderShortcodes -}} + {{ else with $.Page.Resources.Get . -}} + {{ .RenderShortcodes -}} + {{ else with resources.Get . -}} + {{ .Content -}} + {{ else -}} + {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position -}} + {{ end -}} +{{ else -}} + {{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position -}} +{{ end -}}