RSS External Feeds
All external feeds are different so we need to cater for different content. Some feeds don’t contain a summary which we use for article block descriptions or they hold all the html content of the article which I will show examples of later in the document.
Validate Feed
Every time we read a feed we first validate the feed. We have a set of rules for the externals feed which are listed below. We validate the feed every time we read the feed. Below are the sets of rules we validate against.
Block Feed Fixed Requirement
If there is no “published” date or “lastupdated” date for in a single feed item we do not allow the feed to be added or read when in a campaign. Every item in the feed needs a “published” or “lastupdated” date. At the moment I block the whole feed but can change this to only block specific items that don’t contain published or last updated dates. I block the whole feed instead of single items because I feel that that is a consistent requirement but this can be changed easily.
Allow Feeds - But up for review
Descriptions
In Atom feeds you can have a summary and content, or one each. When reading the feeds we first check if there is a summary which is used for the short descriptions if that does not exists we will then use the content tag.
If summary and content exist (atom only) we use the summary for short description and content for long description.
Item in feeds
If a single item does not contain a title we will not read that item. So for example below is an rss feed which does not contain a title, its empty. We allow the feed and will still read the feed but will not include that item.
<channel>
<title>W3Schools Home Page</title>
<link>http://www.w3schools.com</link>
<description>Free web building tutorials</description>
<item>
<title> </title>
<link>http://www.w3schools.com/webservices</link>
<description>New RSS tutorial on W3Schools</description>
</item>
</channel>
Summary Content
Some external feeds use a short description for their summary.
The BBC feed works brilliantly with our article blocks and displays really well in our emails and landing zones.
There are some cases where external feeds use full html content for their summary. Above is an example taken from a mashable rss feed http://feeds.mashable.com/Mashable?format=xml. Which is set as an article block with a thumbnail, title, summary, and read more.
The large image at the top of the content is the thumbnail generated, I have chosen an article block where the image is not a fixed width that’s why it’s so large. The rest is html content use in the short description.
So you can see in the examples of the two feeds, one with a short description and the other is a full html content.
The second feed (mashable) is valid we just need to make the user aware that they need to fully test the rss feed with different article blocks so it fits to their email design.
Thumbnails
We get the thumbnails using the <media:thumbnail> tag. The media namespace is a custom yahoo namespace. All the external feeds I have found used these the media namespace to hold their thumbnails.
If there is only one thumbnail we set the thumbnail in the article block as the small and the large image. If there are 2 thumbnails the first thumbnail is set as the small image and the second thumbnail is set as the large image. Not all feeds contain thumbnails, but every feed that does uses the media namespace.
Namespace
For example if I have a feed which is a gator news feed, I can create a custom namespace called “gatortag” which is used for internal purposes. When we read that feed unless we code to search for that namespace will are not aware of that namespace or its use. If you look at the mashable feeds code, that has lots of custom namespaces http://feeds.mashable.com/Mashable?format=xml.
Mappings
Above is the mappings we use for either Atom feeds or RSS 2.0 feed to our Article Blocks.