Let value shortcode display data from page metadata (below "values") first and then fallback to global values

This commit is contained in:
sixtus 2022-10-09 20:12:26 +02:00
parent 6669387f75
commit 8e18468f1f
1 changed files with 3 additions and 1 deletions

View File

@ -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 }}