ideas
ideas copied to clipboard
Better handling of inline bard images
I recently had to use a bard inline image (with the image button) because of a design choice. It would be nice if we could hook into what it actually outputs. The things I was missing:
- An actual picture element with a definable srcset and sizes.
- Use the alt text you set in the asset library
- The ability to add classes.
Most flexible would be if you could template this out yourself in Antlers somehow.
And captions... đŸ‘€ output as figcaption tags... inside a figure tag...
And prevent other file types than images...
You could try using https://statamic.com/addons/jacksleight/bard-mutator to change images into whatever html you want.
Unfortunately too late: I migrated yesterday a lot of content by hand from bard image to a bard set with image to get the desired result. (Which, fortunately, solved this problem too)
I only left my insights here, if somebody one day improves the behavior of the image to prevent people from beeing frustrated... :)
My comment was more directed at the the original idea, sorry.
Closing as it's quite simple using the Bard Mutator addon. There's even an example in the docs about how to change to picture
elements:
https://jacksleight.dev/docs/bard-mutator/examples#render-all-images-with-a-custom-view-partial