Add featured image in mail template
-
Hi, does anyone know how to automatically add the featured image of a post in the Brevo mail template aside the {{ item.TITLE }} and other {{ item. }} variables?
-
Hi, from what I understand, the RSS campains integration used here fetches the {{ item.xxxx }} in the RSS feed of the site, in between the <item> </item> tags, correct?
I could find here the following tags : title, pubdate and description which I supposed are used as {{ item.title }}, {{ item.pubdate }} and {{ item.description }} variables in the mail template for the campaign, correct?
Now, for the featured image, this is quite much complicated I guess. Here’s what it looks like in the feed, for instance :
<content:encoded><![CDATA[ <figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://domain/wp-content/uploads/YYYY/MM/picture.jpg?w=625" alt="" class="wp-image-8536" style="aspect-ratio:0.7503099988727314;width:624px;height:auto" /><figcaption class="wp-element-caption"> <em><sup>Caption...</sup></em></figcaption></figure>>many texts
]]></content:encoded>
So I guess this is the reason why it’s not that easy to import the featured image in the newsletter template, am I wrong?And does it mean there’s no way to do what I’d expect?
Hi,
Thank you for the detailed explanation. Your understanding is largely correct.
Brevo’s RSS campaigns work by reading the elements available in the RSS feed, specifically the data contained within each
<item>block. These elements are then exposed as{{ item.* }}variables in the email editor.For standard RSS tags such as:
<title>→{{ item.title }}<pubDate>→{{ item.pubdate }}<description>→{{ item.description }}
your assumptions are correct.
Regarding the featured image: Brevo does not currently parse HTML content inside complex tags like
<content:encoded>to automatically extract specific elements such as images. Since the featured image in your case is embedded as HTML withincontent:encoded(along with other text, markup, and captions), the system cannot reliably isolate just the image URL to expose it as a dedicated{{ item.image }}or similar variable.Because of this, there is no built-in way today to automatically pull the featured image into the template unless the image URL is provided as a separate, clean RSS field (for example via:
<media:content>/<media:thumbnail><enclosure>- or a custom image tag generated by the CMS or plugin)
What are the possible options?
- Adjust the RSS feed output: Some CMSs (like WordPress) or RSS plugins allow you to add the featured image as a dedicated tag (e.g.
media:content). If the image URL is exposed as its own RSS field, it can then be used in the template. - Include the image manually in the content: If the image is already part of the HTML in
content:encoded, you may choose to display the full content instead, but this offers limited layout control. - Custom feed: Creating a custom RSS feed that explicitly exposes the featured image URL is the most reliable approach if this is a key requirement.
So yes — your analysis is correct, and the limitation comes from how the image is embedded in the feed rather than from the email template itself.
Thanks very much @shreyachawla!
I’m now looking at customizing the RSS feed output, I’ll let you know what I could find and do.
That was it, I needed to customize the RSS feed. I used the ‘Featured Images in RSS for Mailchimp & More’ plugin to do that (and add to play a bit with some CSS code to have the newsletter look like I wanted).
You must be logged in to reply to this topic.