Render images in Statamics Bard
The Bard fieldtype is a beautiful idea to create long texts containing images, code samples - basically any sort of content. While I was creating my blog I was not sure how to extract images from the Bard field.
Thanks to the Glide tag you can just simply pass the field of your image and it automatically outputs the proper url. My image field is a set called image.
|
|
In your Antlers template for the images just write
|
|
Responsive images
For generating responsive images you can use the excellent Statamic Responsive Images addon provided by Spatie. With this the above snippet changes to that:
|
|
This generates a tag with srcset
to render images for differrent breakpoints.