I have a .json data object that looks like this:
{ images: [ { photo: image.jpg } {something : else} ] }
I want to get access in my dust templating to the image.jpg
item. Is there a straightforward way to select only the first dictionary in that array without looping through? I'd prefer to avoid a loop in my template because it will render a section that is expecting style="background-image: url({photo});"
multiple times.
Use {images[0]} to get just the first element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With