How to Insert Dynamic Content Feeds into an Email
An RSS (aka Really Simple Syndication) Feed is an easy way to share the most up-to-date content you've published on your blog or website.
With Sendlane, you have access to a built-in email feed that you can use to send newsletter updates to your audience -- automatically!
In this article we'll cover:
Before Getting Started
Linking an RSS Feed to a Campaign
- Click New Campaign inside of the Campaigns tab
- Enter a name for your campaign and check the RSS Feed box
- Choose the format of your feed (either RSS or JSON) and enter the URL
- Click Next: Audience to continue the process of building your campaign, and move on to the next section!
Building an RSS-Based Campaign
- title
- description
- content
- image - html <img> tag
- image_url
- author
- link
- date
RSS works in both of our email builder formats (drag-and-drop or HTML) and uses the same syntax. To implement this, when inside of the Email Builder drag an HTML block into your email:
Next, place the code necessary for printing the proper attributes you want to display inside the HTML content block. Below we have listed all of the available attributes to choose from.
Printing Details of a Single Post
Use ‘.0’ for the first post, ‘.1’ for the second post, etc. in the following syntax (keeping only the items you need):
{{ RSS.items.0.title }}
{{ RSS.items.0.description }}
{{ RSS.items.0.content }}
{{ RSS.items.0.image }}
{{ RSS.items.0.image_url }}
{{ RSS.items.0.author }}
{{ RSS.items.0.link }}
{{ RSS.items.0.date }}
Printing a Loop of Posts
Use the following syntax (keeping only the items you need):
{% for item in RSS.items %}
{{ item.title }}
{{ item.description }}
{{ item.content }}
{{ item.image }}
{{ item.image_url }}
{{ item.author }}
{{ item.link }}
{{ item.date }}
{% endfor %}
Please Note
By default, the feed grabs up to 20 items, but this limit can be increased if needed.
Slicing Your Content
To only print 3 items instead of 5, use the ‘slice’ command:
{% for post in JSON|slice(0,3) %}
Randomizing Your Content
To pick a few "random" posts from your feed:
{% set post1, post2 = random(9), random(9) %}
{{ RSS.items[post1].title }}
{{ RSS.items[post1].image }}
{{ RSS.items[post2].title }}
{{ RSS.items[post2].image }}
Troubleshooting
-
Email Builder Errors - Check your HTML code! It could be that there's a typo, a formatting error, or something as simple as a tag that wasn't closed!
- Content isn't displaying as expected - Are you reviewing a Completed campaign? RSS feed content displays in the Preview (before sending) as well as once the email lands in your inbox, but you'll see the HTML code when viewing a Completed campaign from inside of your Sendlane account.
- Images appearing as links - It's possible that when you use enclosure tags to display images, you will see a link to where the image is hosted instead. Please make sure your web developer sets up your feed to show each item's image using <media:content> RSS tags. Please click here to see how to set up your feed.
If you hit any other roadblocks, you can get in touch with our team of email marketing automation experts right here!
TL;DR
Before You Get Started → RSS Feed Set Up
Linking Your Feed To A Campaign: → Go to New Campaign inside Campaigns Tab → Enter name for Campaign and check the RSS Feed box → Choose the format of your Feed (RSS or JSON) → Enter URL → Click Next: Audience & Continue
Building An RSS-Based Campaign: → Choose the Properties you want to Display and Choose how you want to Display them