Embed field improvements

Hello,

I'm using the Embed field in the rich text editor and, regarding the "link" type (for example, when I use this link as embed URL), I have a few thoughts and questions:

  1. The most important is that the html field uses an <h1> for the title, which I believe is not appropriate since the content is external and is unlikely to be the main subject of the page.

  2. In the html field, it would be helpful if classes were included for the title, thumbnail, and excerpt elements so they can be targeted more reliably with CSS.

  3. The <img> element should ideally include the loading="lazy" attribute.

  4. It would be much more useful if these parts were returned separately so we could create our own structure. Currently, only the title and thumbnail are returned.

  5. Finally, would it be possible to include additional details from the embed URL, such as the website name and favicon?

Thank you in advance.

Hello @john-mantas,

Thanks for raising this! The Embed field in Prismic relies on the oEmbed response provided by oEmbed (for example when embedding a link or video). The html field you receive is generated by that provider, which means the markup inside it (like the <h1> , missing classes, or image attributes such as loading="lazy" ) is unfortunately not controlled or modified by Prismic.

Because of that, the structure inside html can vary depending on the provider and cannot be customized from Prismic itself.

If you need more control over the markup, you could see if it's possible to avoid rendering the html field directly and instead build your own structure using the other fields returned in the embed data (such as title , thumbnail_url , provider_name , etc.). This allows you to apply your own semantic HTML, classes, and attributes.

Regarding additional metadata like website name or favicon, again the availability of those fields depends on what the oEmbed provider returns.

With that said we appreciate the feedback about improving the flexibility of the embed data structure, and I’ll make sure to pass it along to our product team. Thanks :slight_smile:

1 Like