How can I use dynamic email content with a RSS feed?

Using RSS feeds, you can pull in content from your blog, YouTube channel, Etsy store, podcast, and so much more! You can easily add your feed to your message using the Feed element

Feed element demonstration

Dynamic email content is a fun, powerful feature that helps you include content feeds in your messages. Using Dynamic Email Content, you will be able to include up to date content from RSS and other feeds to your message. Dynamic content is an advanced tool designed to help you make them most of your content.

With dynamic content, you will be able to quickly create your message so that you can spend less time crafting and perfecting your messages and more time doing the things you love.

RSS Feed Details

Feed Content
{% for entry in feed_content('https://blog.aweber.com/feed', num_entries=4, categories=['learn','ecommerce','email automation']) %}...{% endfor %}

Dynamic email markup to include the feed content.

Replace https://blog.aweber.com/feed with the RSS URL for your website, podcast, etc. Use num_entries to specify the number of items you would like to pull to your message. 

{% for entry in feed_content('https://blog.aweber.com/feed', num_entries=4), categories=['learn','ecommerce','email automation'] %}...{% endfor %}

You can also take it a step further by specifying which categories to include.

Feed Content (Alternative)
{% content_feed('https://blog.aweber.com/feed', 4) %}... {% endcontent_feed %}

Alternative dynamic email logic to print the RSS feed. Using this format will allow you to extract the website's name, description, and link.

Replace https://blog.aweber.com/feed with your RSS of your website, podcast, etc. Replace the numerical value to the number of items you would like to pull to your message.

{{ feed.title }}

This variable will pull the website's title.

{{ feed.description }}

This variable will pull the website's description.

{{ feed.link }}

This variable will pull the link to the website's URL.

Title
{{entry.title}}

This variable references each item's title.

Description
{{entry.description}}

This variable references each item's item's description.

{{ entry.description_text }}

This variable references each item's description as plain text.

{{ entry.description_html }}

This variable references each item's description as HTML.

Content (HTML)
{{entry.content_html}}

This variable references each item's full content in HTML format.

Content

(Plain Text)

{{entry.content_text}}

This variable references each item's full content in plain text format.

Author
{{entry.author}}

This variable references each item's author.

Link
{{entry.link}}

This variable references the URL where the item can be found on the web.

Image
{{entry.image}}

This variable references each item's image URL.

Published Date
{{ entry.published_at|date_format("MMMM d, YYYY") }}

This variable references each item's published date.

You could also choose to format your published date.

Item Category
{{entry.category}}

This variable references each item's list of categories.

 

Media RSS Feed Details

Media Content
{% for media in entry.enclosures %}...{% endfor %}

Dynamic email logic to print additional media items from the RSS feed.

Media URL
{{media.url}}

This variable will pull the media item's direct link.

Media Length
{{media.length}}

This variable will pull the media item's duration.

Media Type
{{media.type}}

This variable will pull the media item's type.

 

✨ Quick Tip

There are a few special variables available that may come in handy. For example, let's say you want to include some information about your feed in your message's subject line. It's easy to do this with a succinct variables. Note, the "feed" variable below, always refers to the first feed included in your message.

The feed title
{{ feed.title }}
The title of the feed's first post.
{{ feed.entry.title }}
Example as used in a dynamic subject line.
New posts from {{feed.title}}: {{feed.entry.title}}

 

Additionally, if you're looking to display RSS data from a specific timeframe, such as the past 'X' days, you can achieve this by adding a filter based on the published date.

Published Date Filter
{% if entry.published_at | date_format('YYYYMMDD') > now | date_format('YYYYMMDD', shift_days= -7) %}...{% endif %}

The timeframe can be modified by adjusting the number of days shifted in shift_days= -7 or by using a different date comparison operator to suit your needs.

Example
{% for entry in feed_content('https://feeds.megaphone.fm/MOBI8777994188', num_entries=25) %}
{% if entry.published_at | date_format('YYYYMMDD') > now | date_format('YYYYMMDD', shift_days= -7) %}
{{entry.title}}
Published: {{ entry.published_at | date_format('YYYYMMDD') }}
{% endif %}
{% endfor %}

 

Blog Example

Using dynamic email content, you can dynamically pull in content from your blog to continue driving traffic back to your website. In this example, we will be pulling articles from AWeber's blog.

Note: If you're looking to have an image pulled, you need to ensure to add an image block to your message in order for the image to show.

{% for entry in feed_content('https://blog.aweber.com/feed', num_entries=4) %}
{{entry.image}}
{{entry.categories | first | upper() }}
{{entry.title}}
By: {{entry.author}}
Published: {{ entry.published_at|date_format("MMMM d, YYYY") }}

{{entry.description}}

Read More: {{entry.link}}
{% endfor %}


4429048344219_example.png

When clicking Preview & Test or sending a test message, you will see that the latest blog posts are pulled to your message.

4429048344219_examplepreview.png

Podcast Example

Using dynamic email content, you can dynamically pull in content from your podcast. When available, you can also pull in the podcast's image and include a clickable, listenable playbar.

{% for entry in feed_content('https://rss.art19.com/civilized', num_entries=3) %}
{% for media in entry.enclosures %}
{{entry.image}}
LISTEN NOW: {{media.url}} 
{% endfor %}
{% endfor %}


4429048344219_podcast.png

When clicking Preview & Test or sending a test message, you will see that the latest podcast episodes are pulled to your message.

4429048344219_podcastpreview.png

YouTube Example

Using dynamic email content, you can dynamically pull in videos directly from your YouTube channel. 

{% for entry in feed_content('https://www.youtube.com/feeds/videos.xml?playlist_id=PL8AXHreasJeimtvj0CYBaApVm8vjzPCZP', num_entries=3) %}
{{entry.image}}
{{entry.title}}
Watch: {{entry.link}}
{% endfor %}


4429048344219_youtube.png

When clicking Preview & Test or sending a test message, you will see that the latest podcast episodes are pulled to your message.

4429048344219_youtubepreview.png

Etsy Store Example

Using dynamic email content, you can dynamically pull in content from your Etsy store to continue driving traffic back to your shop.

{% for entry in feed_content('https://www.etsy.com/shop/PhilaCarta/rss', num_entries=3) %}
{{entry.image}}
{{entry.title}}
Buy Now: {{entry.link}}
{% endfor %}


4429048344219_etsy.png

When clicking Preview & Test or sending a test message, you will see that the latest Etsy products are pulled to your message.

4429048344219_etsypreview.png


For more information on dynamic email content, and the different types of variables that you can include when coding for dynamic email content, check out the articles below:

Have more questions? Submit a request