I suspect I’m missing something obvious but I’m in desperate need of some guidance. I’m defining a list of images within the front-matter of a static page.
gallery:
- title: "Title 01"
filename: "filename01.jpg"
- title: "Title 02"
filename: "filename02.jpg"
Then accessing from within my template.
{{ range $ind, $ele := .Params.gallery }}
<img src="/img/gallery/{{ $ele.filename }}" title="{{ $ele.title }}"/>
{{ end }}
I’ve tried…
{{ range .Params.gallery }}
<img src="/img/gallery/{{ .filename }}" title="{{ .title }}"/>
{{ end }}
Neither variant works.
I always get the same error.
“can’t evaluate field filenam in type string”
Please advise. I’m completely stuck.