If I have a data layout like below in a file called example.yaml, how can I access value1 with key1 in Go?
key1: value1
key2: value2
In python, if I had read the above data into a dictionary (say dict1), I would be able to simply access value1 using:
dict1['key1']
However, I am struggling to find a simple solution using hugo. The working solution I have seems to be an inefficient and round about way:
{{ with .Site.Data.example }}
{{ range $key, $value := . }}
{{ if eq $key "key1" }}
{{ $value }}
{{ end }}
{{ end }}
{{ end }}
Is it possible to access a dict value using a key in Go, without the need for the above? Thanks in advance for any help!