RSS and Atom Feed Tutorial

for Content Publishers and Webmasters

Introducing Feeds

Think about all of the information that you access on the Web on a day-to-day basis: news headlines, search results, “What’s New”, job vacancies. A large amount of this content can be thought of as a list of updates.

Most people need to track a number of these lists, but it becomes difficult once they have more than a handful of places they want to keep up-to-date with. This is because they have to go to each page, load it, remember how it’s formatted, and find where they last left off in the list.

A Web feed is a document format that allows the syndication of lists of content, often with hyperlinks, along with other information.

This allows peoples’ computers to fetch and understand the information, so that all of the lists they’re interested in can be tracked and personalized for them. It is a format that’s intended for use by computers on behalf of people, rather than being directly presented to them (like HTML).

To publish a feed, a Web site publishes a document, just like any other document on their Web server. Once a feed is available, computers can regularly fetch the feed document to get the most recent items on the list. Most often, people will do this with an aggregator, a program that manages a number of feeds and presents them in a single interface.

What’s in a Feed?

A feed document has information about the feed itself, called feed metadata – things like the title of the feed, who publishes it, and where to find it on the Web. That’s followed by a list of items or entries.

A basic item will include a link, a title, and a description. Most feeds also contain the associated content (marked up with HTML) and other metadata, like when the item was published.

Generally, the items in the feed will be the most recent things that have been published in the feed. For example:

<rss version="2.0">
  <channel>
    <title>My Example Updates</title>
    <link>http://example.com/</link>
    <description>Things that I've recently updated.</description>
    <item>
       <title>New Paper Published</title>
       <link>http://example.com/2002/09/01</link>
       <description>My paper was published in the Example Journal today.</description>
    </item>
    <item>
       <title>Research Project Results</title>
       <link>http://example.com/2002/09/02</link>
    </item>
  </channel>
</rss>

Note that this example doesn’t include feed content - your feed should!

Why Should I Publish a Feed?

When you publish a Web site, people only become aware of updates when they visit it. Unless they have a reason to visit your site regularly, your content will get lost in the noise of all the other information that busy people need to track. Even when they do visit your site, they’ll have to remember how to find their way around (since every site’s navigation and style are different), and find where they left off.

All of this creates friction against people seeing your latest content. When people who are interested in your content are able to subscribe to a feed for it, that friction is greatly reduced. They’ll open a feed reader (sometimes called an aggregator) and the latest updates from all the sites they’re interested in are there for them – presented in a consistent way, and usually remembering where they left off. Your updates will get seen more reliably.

For example, imagine that your organization makes an announcement every month or two. Without a feed, your readers have to remember to come to your site and see if they find anything new — if they have time. If you provide a feed for them, they

The tradeoff is that you don’t have complete control over how the feed content is presented to your readers. While you can use basic HTML elements like <p>, <em>, <strong>, <h1>, <a> and so forth, you can’t control the stylesheet, and you can’t use JavaScript. These limitations make it possible to present feeds from many different sources consistently to readers.

It also means you can’t put targeted ads into your feeds, and so sites that use privacy-invading techniques to track users probably won’t publish Web feeds. These factors create a feed ecosystem made up of sites like academic publishers, expert commentary, and other information that tends to be intrinsically valuable. Web feeds aren’t about “driving eyeballs” or monetizing users; they’re about making sure that good content gets in front of people who are interested in it.

Web feeds are conceptually similar to the feeds you can get on social media sites like Twitter or Facebook, but with an important difference: you completely control the content in your feed, so it’s a direct line of communication between you and your audience. A third party can’t control what people see from your content, or how it’s presented.

What is Your Feed About?

Any list-oriented information on your site that your viewers might be interested in tracking or reusing is a good candidate for a feed. This can encompass news headlines and press releases, job listings, conference calendars and rankings (like ‘top 10’ lists).

For example:

While it’s a good start to have a “master feed” for your site that lists recent updates, don’t stop there. Generally, each area of your site that features a changing list of information should have a corresponding feed; this allows viewers to precisely target their interests.

Think about it from the reader’s standpoint. If they’re looking at a news site, a full feed of everything on it will quickly become overwhelming, and will contain many entries that don’t interest them. If separate feeds are available for the different sections (local news, sports, business, etc.), they can tailor what they subscribe to to make it more relevant.

If your site offers a personalized view of updates (e.g., people can choose categories of information that will show up on their home page), offer this as a feed specific to them, so that the viewers’ Web pages match the content of their feeds.

Publishing Your Feed

All of these Content Management Systems support Web feeds “out of the box”:

If yours isn’t listed, search for “rss feed” and “atom feed” alongside its name; usually, the community will have come up with a solution. For example, these Content Management Systems have community-contributed modules or guides for publishing feeds:

You can also create a feed programmatically; most languages have good tools for doing so. There are also tools for scraping a feed from HTML content, although this can be unreliable.

Choosing a Feed Format

There are two major feed formats in use today; RSS2.0 (as seen in the example above) and Atom, which looks like this:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Example Feed</title>
  <link href="http://example.org/"/>
  <updated>2003-12-13T18:30:02Z</updated>
  <author>
    <name>John Doe</name>
  </author>
  <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

  <entry>
    <title>Atom-Powered Robots Run Amok</title>
    <link href="http://example.org/2003/12/13/atom03"/>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <updated>2003-12-13T18:30:02Z</updated>
    <summary>Some text.</summary>
  </entry>
</feed>

For most purposes, both formats work fine; all feed readers will support both of them, so choose the one that works best for you. There isn’t any reason to publish in both formats.

Telling People About Your Feed

People need to know the feed is there, and there are two methods for advertising it:

  1. Linking to it from your site, so that people can see you have a feed, and
  2. Putting feed autodiscovery information into your Web pages, so that machines can discovery your feed.

You should do both.

First, place a ‘feed’ icon on your pages in an appropriate spot (for example, in the page navigation section):

<a type="application/rss+xml" href="feed.rss"
title="feed for this blog" class="feedbutton">feed</a>

where ‘feed.rss’ is the URL for the feed. the ‘type’ attribute tells browsers that this is a link to an RSS feed in a way that they understand.

Most people recognise feeds that are advertised with an orange button, so use a style like this:

.feedbutton, a.feedbutton:link, a.feedbutton:visited, a.feedbutton:active, a.feedbutton:hover {
  border: 1px solid;
  border-color: #FC9 #630 #330 #F96;
  padding: 0 3px;
  font: bold 10px sans-serif;
  color: #fff;
  background: #F60;
  text-decoration: none;
}

Second, to support autodiscovery, include a tag in the page’s metadata:

<html>
<head>
  <title>My Page</title>
  <link rel="feed alternate" type="application/rss+xml"
   href="feed.rss" title="Feed for My Page">
</head>

Note that Atom feeds should use application/atom+xml rather than application/rss+xml in both.

Tips for Great Feeds

You wouldn’t publish a Web site without checking it with a Web browser, would you? The most important thing you can do as a publisher is to subscribe to your own feeds, ideally with more than one feed reader. That will give you an idea of how your feed is presented to different people, and how they will consume it. It will also help you catch weird presentation bugs with things like HTML entities, and Unicode (which are more common than you think).

Subscribing to your own feeds also gives you an opportunity to consider your feed content from a reader’s point of view. For example, while it might make sense to publish a weekly roundup of what happend on your Web site, putting that into your feed is only going to annoy readers there, because they’ve already seen everything you’ve published this week. This means there should never be a feed entry with a title like “Week in Review” or “Monthly Newsletter”.

Likewise, tailor your feeds for a variety of audiences. For example, if you run an academic institute, someone might want to keep up with the papers your staff have published, but probably don’t want to read materials that are more appropriate as press releases.

Make sure your feed title is concise and relevant. It’s what feed readers will identify your feed to users with, so don’t include “rss feed” or “feed” in the title; they already know they’re reading a feed. Don’t make it too wordy, but if your site has more than one feed, make it specific enough to differentiate them. Don’t over-use punctuation.

So, instead of “The Example Institute RSS Feed: New Articles”, just use “Example Institute”. If it’s a more specific feed, use something like “Example Institute Press Releases”.

Publish complete articles in your feed, rather than making your readers follow a link to finish something. They’ll appreciate it.

Finally, a few important technical tips:

Don’t Change Your Feed Link. When someone subscribes to your feed, their feed reader software remembers that link; if it changes, they’ll think your feed is broken and unsubscribe. While feed readers do follow redirects (for example, 301 (Moved Permanently)), they don’t remember them, so using redirects will add extra load to your server.

Make your feed cacheable. Successful feeds see a fair amount of traffic because clients poll them often to see if they’ve changed. To handle the load, make sure support caching.

Validate your feed. use the Feed Validator to catch any problems in your feed; it works with RSS and Atom. Also, don’t just run it once; make sure you regularly check your feed, so that you can catch transient errors.

About this Document

This document is by Mark Nottingham, Copyright ©2002-. The latest revision of this document can always be obtained from https://www.mnot.net/rss/tutorial/.