Oddly, this only works if I add the .image part while my local hugo server is running. As soon as I stop and start it again, the site fails to rebuild with the following error:
... execute of template failed: template: partials/content/figure.html:7:70: executing "partials/content/figure.html" at <0>: can't evaluate field image in type string
I just want to be able to access images[0].image. How can I make this work?
Thanks for the reply! I’m working in a template that does a bunch of other things with $image. Is there some way to get it and store it in the $image variable similarly to how it’s defined above?
It turns out I had some other content types whose front matter still had images in a simple array rather than an array of objects. I finally solved it using @jmooring’s help, like this:
This allows me to have some content types with multiple images and image captions stored as an array of objects in front matter (see OP above), while other content types simply have a single image or an array of images without captions.
Hope others find this useful. Thank you @jmooring!