Fix value shortcode to not access (faulty) variables before checking them
This commit is contained in:
parent
06bbc38931
commit
0286df9711
|
@ -1,12 +1,12 @@
|
|||
{{- $section := default (.Get 0) (.Get "section") -}}
|
||||
{{- $key := default (.Get 1) (.Get "key") -}}
|
||||
{{- $value := index $.Site.Data.values $section $key -}}
|
||||
{{- if not $section }}
|
||||
{{- errorf "missing parameter 'section': %s" .Position }}
|
||||
{{- end }}
|
||||
{{- $key := default (.Get 1) (.Get "key") -}}
|
||||
{{- if not $key }}
|
||||
{{- errorf "missing parameter 'key': %s" .Position }}
|
||||
{{- end }}
|
||||
{{- $value := index $.Site.Data.values $section $key }}
|
||||
{{- if not $value }}
|
||||
{{- errorf "missing, empty or null value at 'values/%s.%s': %s" $section $key .Position }}
|
||||
{{- end }}
|
||||
|
|
Reference in New Issue