File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 60
60
{{/* We look for the matching data file located in `data/netlifycms/{Type}/{File}.yaml` */}}
61
61
{{ with index site.Data.netlifycms (pluralize $type) }}
62
62
{{ $with := index . $file }}
63
+ {{/* If we find a "." in the File string, it means user is trying to access a nested value.
64
+ We'll split the string and check for two nesting level max
65
+ */}}
63
66
{{ $file_split := split $file "." }}
64
67
{{ if eq (len $file_split) 2 }}
68
+ {{/* We have something like `import fields greeting.spanish */}}
65
69
{{ $with = index . (index $file_split 0) (index $file_split 1) }}
70
+ {{ else if eq (len $file_split) 3 }}
71
+ {{/* We have something like `import fields greeting.spanish.singular */}}
72
+ {{ $with = index . (index $file_split 0) (index $file_split 1) (index $file_split 2) }}
66
73
{{ end }}
74
+
67
75
{{ with $with }}
68
76
{{ $return = . }}
69
77
{{ with $extend }}
70
78
{{ $return = merge $return . }}
71
79
{{ end }}
72
80
{{ else }}
73
81
{{ $message := printf "We couldn't find %s/%s" $type $file }}
74
- {{ with split $file "." }}
82
+ {{ with $file_split }}
75
83
{{ if gt . 2 }}
76
84
{{ $message = print $message " because object depth is limited to 2" }}
77
85
{{ end }}
You can’t perform that action at this time.
0 commit comments