Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions layouts/shortcodes/params.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{/* This shortcode provides access to global site params */}}
{{- $paramString := .Get 0 -}}
{{/* split param string into keys by . to get access to nestend parameters value */}}
{{- $keys := split $paramString "." -}}
{{- $value := .Site.Params -}}
{{- $exists := true -}}
{{- range $keys -}}
{{- if $value -}}
{{- $value = index $value . -}}
{{- else -}}
{{- $exists = false -}}
{{- end -}}
{{- end -}}
{{- if not $exists -}}
{{- errorf "Config shortcode: key '%s' does not exist in site config." $paramString -}}
{{- end -}}
{{- $value -}}