Hi there. Obviously missing something basic but when I try and access a property inside a data file using the key: name rather than just it’s index (eg.0, 1) I keep getting an error.
<index $value "active">: error calling index: cannot index slice/array with type string
This works:
{{ range $k, $v := .Site.Data.navigation.global.top }}
{{ range $key, $value := $v }}
{{ range (index $value 0) }}
{{.}}
{{ end }}
{{ end }}
{{ end }}
This doesn't:
{{ range $k, $v := .Site.Data.navigation.global.top }}
{{ range $key, $value := $v }}
{{ range (index $value "active") }}
{{.}}
{{ end }}
{{ end }}
{{ end }}
Data file:
top:
- product:
- active:
product
security
demos