From 6c38574055330d39214b2ac2aa9df828a02a2c1e Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 3 Jan 2022 15:21:25 +0000 Subject: [PATCH] fix: cite shortcode in v5.5-dev is missing page context Fix #2578 --- test/config.yaml | 2 ++ wowchemy/layouts/partials/functions/render_view.html | 2 +- wowchemy/layouts/shortcodes/cite.html | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/config.yaml b/test/config.yaml index e6c551de..c00e6e14 100644 --- a/test/config.yaml +++ b/test/config.yaml @@ -10,6 +10,8 @@ disableAliases: true taxonomies: [] markup: _merge: deep +security: + _merge: deep params: require_isotope: false day_night: true diff --git a/wowchemy/layouts/partials/functions/render_view.html b/wowchemy/layouts/partials/functions/render_view.html index 7eacab72..73e9df4e 100644 --- a/wowchemy/layouts/partials/functions/render_view.html +++ b/wowchemy/layouts/partials/functions/render_view.html @@ -8,7 +8,7 @@ {{ $index := .index }} {{if eq $view_dtype "int" | or (eq $view_dtype "int64") }} - {{/* Support legacy numeric views 1-4 */}} + {{/* Support legacy numeric views 1-5 */}} {{ if eq $view 1 }} {{ $view_file = "list" }} {{ else if eq $view 3 }} diff --git a/wowchemy/layouts/shortcodes/cite.html b/wowchemy/layouts/shortcodes/cite.html index 98847914..4fb8c552 100644 --- a/wowchemy/layouts/shortcodes/cite.html +++ b/wowchemy/layouts/shortcodes/cite.html @@ -1,8 +1,12 @@ +{{ $page := .Page }} {{ $item := .Get "page" }} {{/* Default compact view. */}} {{ $view := (.Get "view") | default "compact" }} +{{/* Hugo stores all shortcode args as strings, however `render_view` expects legacy numeric views 1-4 to be int */}} +{{ $view = cond (in (slice "1" "2" "3" "4") $view) (int $view) $view }} + {{ with site.GetPage $item }} - {{ partial "functions/render_view" (dict "page" $ "item" . "view" $view "index" 0) }} + {{ partial "functions/render_view" (dict "page" $page "item" . "view" $view "index" 0) }} {{ end }}