From 8e18468f1f10830708fa7d74d833e77e53e9aee1 Mon Sep 17 00:00:00 2001 From: Frieder Griesshammer Date: Sun, 9 Oct 2022 20:12:26 +0200 Subject: [PATCH] Let value shortcode display data from page metadata (below "values") first and then fallback to global values --- layouts/shortcodes/value.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/value.html b/layouts/shortcodes/value.html index 8d35d0b..ad30c06 100644 --- a/layouts/shortcodes/value.html +++ b/layouts/shortcodes/value.html @@ -6,7 +6,9 @@ {{- if not $key }} {{- errorf "missing parameter 'key': %s" .Position }} {{- end }} -{{- $value := index $.Site.Data.values $section $key }} +{{- $page := index (default dict (index (default dict (index $.Page.Params "values")) $section)) $key }} +{{- $site := index (default dict (index $.Site.Data.values $section)) $key }} +{{- $value := default $site $page }} {{- if not $value }} {{- errorf "missing, empty or null value at 'values/%s.%s': %s" $section $key .Position }} {{- end }}