I have an array in my post’s front matter
---
images: ["1.jpg", "2.jpg", "3.jpg"]
---
From my templates I can range through this array without any problems:
{{ range $index, $image := .Params.images }}
{{ $index }} {{ $range }}
{{ end }}
But what if I want to get the first element of this array? I tried with Index but it doesn’t work
{{ index .Params.images 0 }}
{{ index (index .Params "images") 0 }}
They give me this error:
executing "main" at <index .Params.images...>: error calling index: index of untyped nil
What am I doing wrong?