Caption for images in RichText field

Feature Idea (one per thread):
It's common to see in blog posts the option to add a small caption under the image that might not be the same as the alternative text. Would be great to have the option to enter a caption for images that are added within a rich text field, perhaps making use of <figcaption> so we can style it like other elements .

Issue that it solves:
Can't add and display image captions in the rich text field.

Screenshot or video of the issue (if applicable):

1 Like

Hello Gisete,

Welcome to the Prismic Forum and thanks for reaching out to us.

Currently, there is no direct property such as "figcaption" available for images in the rich-text editor. There is a workaround:

  1. Add some text above or below of the image.
  2. Add labels in your rich text editor. Labels will wrap the selected content in a span element with the class of the given name. You can get full information about labels here.
  3. Then you can add whatever CSS you need for that class and put it as a caption for the particular image.

I'd suggest to use Slices to build your blog post page. Then you can have full control over image blocks. Here is a content modeling article for blog posts that includes an images slice with caption:

I hope it answers your question. Let me know if you have any other doubt.

Thanks,
Priyanka

2 Likes

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.