Syndicate Your Website: Create an RSS Feed in Twenty Minutes

Unlike most Belisarius posts, this one is technical documentation (sorry). It tells you how to create an RSS feed, that is, how to syndicate your web site. If you have no interest in such subjects, please come back to Belisarius for the next post, when things will return to normal. Or subscribe to the RSS feed, and you’ll be notified of updates.

This post allows me to bait traffic with some popular keywords. But no kidding, it’s extremely simple to syndicate your site. If you can add a link to your website, and look at (not necessarily understand) an XML file without getting queasy, you’ve got it made.

What’s an RSS feed?

People disagree about what RSS stands for, but they agree that it’s a method of syndicating your website. It works the same way regardless of how you expand the acronym.

Website syndication operates on the publish-and-subscribe model. The website publishes a description of new material; subscribers receive the description as a notification that the site has been updated. Subscribers need a news aggregator, of which there are many to choose.

One way to think of an RSS feed is this: potential subscribers have TVs that can be hooked into many cable systems at once. Each RSS feed is a single cable, which can carry multiple channels, like a TV cable. For example, an RSS channel could be devoted to a single writer or topic. Your RSS feed can provide subscribers with complete material or summaries of it, accompanied by links to your site.

To create an RSS feed

Creating an RSS feed is easier than you might think:

  1. Create a text file, a site description, containing the article summaries you want to publish and the associated URLs. This step is about 90% of the work, because you have to think about what your descriptions should say.
  2. Put the file on your website.
  3. Link to it.
  4. Validate and test your feed.
  5. Announce your feed to the world.

That’s all I had to do. The last two steps are optional. You normally only need to validate (Step 4) when you make structural changes. If you omit the announcement (Step 5), readers can subscribe to your site directly through your link (Step 3).

Thus, a private feed’s cycle might be simply:

  1. Update the site description file
  2. Put the updated file on your website

A public feed might also alert external update monitors that the site has changed.

Many cases are more complex than mine, with more frequent updates, more authors, multiple channels, and so on. The more complex cases simply expand on and automate this basic formula.

Create a text file

Basically, an RSS feed is a file that subscribers can check. If you update this file, subscribers are notified by their news aggregators that your site has new content.

The site description file is an XML (eXtensible Markup Language) file. If you’re not familiar with markup languages, don’t be intimidated; all you’re doing is filling in a form.

The site description file publishes information about your newest articles. You decide what “new” means: what to say about the new articles; what the title text should be; what URL each item links to; and so on. Depending on the RSS version you declare, you might be able to specify author names and other information for each item.

A site description file includes:

  • An announcement of the file type (“this is an RSS feed”)
  • A description of each channel this feed delivers
  • A description of each item each channel is featuring

Channels and items are enclosed in special tags. They each have three basic attributes: titles, descriptions, and links, as in this example. Note that XML differs from HTML in requiring end-tags for most elements.

<?xml version="1.0" ?> 
<rss version="2.0">

  <channel>

  <title>Belisarius Blogs!</title>
  <description>A forum for discussion of civic life
  </description>
  <link>http://home.earthlink.net
    /~count_belisarius/</link>

    <item>
    <title>A Platform for a Party of the Left</title>
    <description>
     What's a reasonable platform for a party of the
     left?  The 2004 Democrats were hopeless, and the
     Green platform seemed to be Elect the Democrat.
     Here's my first cut at a platform I call
     Full Employment, Fair Care.
    </description>
    <link>http://home.earthlink.net
      /~count_belisarius/platform1.htm</link>
    </item>

  </channel>

</rss>

I’ve broken the URLs onto two lines; because text in HTML “pre” elements doesn’t wrap, the URLs run off the edge of narrow windows. You should follow the normal rules with URLs (such as, “no newlines in URLs”). I added indentation for readability too; it’s not required.

For brevity, I’ve included one channel and one item. Most site description files have several items; some have several channels, each devoted to an author, section, topic, or the like.

Variations are possible in this procedure. For example, as a publisher you can provide a new site description file containing headlines and summaries; or you can update a file whose contents are static (“touch” it), triggering responses from aggregators, which examine subsidiary files for information on new items. I describe the first of these two methods because that’s what I use for Belisarius.

Put the file on your website

To make your RSS feed available, put the site description file on your website. Generally, this means either uploading the file to the site with something like FTP or a browser-based file-transfer program, or creating a new file directly on the server. Methods differ a great deal just across blogging systems alone, not even speaking of non-blog RSS feeds; I call command-line (Windows “Command Prompt”) FTP from batch files for normal uploads, and use Filezilla for by-hand transfers.

However you do it, this step consists purely of putting the site description file on your website. When the file can be accessed like any other on your site, this step is done.

Link to the file

To let readers subscribe to your RSS feed, put links on your website to the site description file. The abbreviated file in my example is called belisarius.rdf; if you want to look at the text, open the file at the other end of this link. However, beware: in most configurations, clicking on that link makes you a Belisarius subscriber as well as showing you the text of the file (you can always unsubscribe after you’ve examined the text). An alternative is to download the text file and look at it with Notepad, Emacs, or the like.

By clicking on the link, readers tell their news aggregator to subscribe to your site (that is, to add your home URL to its list of subscribed sites). Since it checks each item on that list at specified intervals, it’s able to notify readers of updates as soon as they’re available.

There’s nothing special about the format of this link to the site description file:

<a
href="http://home.earthlink.net
/~count_belisarius/belisarius.rdf">
RSS Syndicate this site</a>

Again, I’ve broken the URL onto multiple lines for readability, in lieu of automatic line wrapping. You should follow standard rules for HTML links.

Validate and test your feed

You’ve created a site description file, put it on your website, and linked to it. Now to make sure the whole setup works:

  1. Validate your site description. The validator checks for syntax errors. It can save you hours of wild-goose chases by finding that missing slash or quote.
  2. Start your news aggregator.
  3. Make sure your news aggregator is not subscribed to the feed you’re about to test.
  4. In your browser, click on the link to your site description file.
  5. Check your aggregator—you should now be subscribed to the feed you’re testing. You might need to refresh the view to see the change.

Did it work?

If this works, you’re done with the basic task. You might want to consider adding your feed to the big public ticker. You might want to consider automating some of these tasks or looking at alternative implementations, too. If you don’t want to do these things, you’re done.

If the test didn’t work, you could start by checking for issues such as these:

  • Have you set options in your aggregator so that some panels are not showing up? I don’t mean to insult you, but I had this problem and it took me about an hour to figure it out. Of course, this is partly because Opera has so many options. Anyway, I hadn’t set my Mail panel to show my news accounts, just my email accounts. The menu item Mail->Show Accounts->All Accounts fixed everything.
  • Have you done whatever refresh operations are available, in other words, checked the mailboxes and subscriptions? Maybe you should try clearing your browser’s cache…
  • If everything’s set on the previous two, are other sites you’ve subscribed to showing up in your aggregator as you expect? I did the things I’ve just listed, and it worked the first time.

Announce your updates

You’ve probably seen the news tickers with reports from AP, Reuters, AFP, and so on streaming across them. There’s a similar public ticker of RSS feeds, to which you can add yours if you choose.

To add your feed to the public ticker, enter your URL at feed aggregator websites. Two popular feed aggregators are:

You normally do this once when you create your feed. As of January 2005, basic levels of these services are free.

Each time you update your site, you can announce that fact by notifying sites that monitor updates. Two popular monitors are:

Both sites have brief forms to fill in, announcing that your site’s been updated. Again, as of January 2005, basic levels of these services are free.

Danny Sullivan helpfully expands on this and related topics at SearchEngineWatch.

Is that all there is?

If you’re willing to update your site description file by hand, yes, that’s all there is.

If you update your site frequently, you have a variety of authors, or otherwise have a more complex site than mine, you’ll probably want to consider automating the creation of your site description file. However, I currently have no experience with the automating tools, so I can make no recommendations.

Caveats

Researching the page you’re reading, I found that two- and three-year-old articles about RSS feeds by good writers were reliable with respect to the big picture, but needed verification on the detailed level, because standards had changed. Therefore, especially if you have problems or are doing something exotic, I recommend searching for newer articles than this on the subject—this one was originally written in January, 2005 (but check the final line of the post for the last update).

In this example I’ve used RSS version 2. There are at least two other popular versions, 1.0 and 0.91. The differences may or may not matter, depending on what sort of information you want to publish; Google to make sure. Specifying version 2, I call my my site description file “belisarius.rdf”. I believe you need to use “xml” instead of “rdf” if you use RSS version 0.91; I think either works with version 1. But almost all my testing has been with version 2, so check these statements before depending on them.

Subscribers need a news aggregator

Readers who syndicate your site need a news aggregator to collect notices from updated sites. News aggregators are programs that check a list of URLs to see if they’ve been updated.

The article I mentioned earlier has brief summmaries of some popular aggregators (at the time it was written).

News aggregators are sometimes incorporated into email programs and browsers. For example, my news aggregator is the same program I use for browsing and email: Opera. I’m one of several contributers to Bad Attitudes, so I subscribe to it. When I open my Mail panel, I see bold headings and counts for new email, and for new posts at Bad Attitudes and other sites I subscribe to. Expanding those headings leads to an email-like message for each new post; from Bad Attitudes, I get a title, a brief description, and a URL.

When your site description file is updated, news aggregators flag your site to their readers. For example, I set Opera to check the Bad Attitudes feed for updates every five minutes. Every five minutes (when I’m on the web), Opera contacts the Bad Attitudes site and checks the site description file. If it’s been updated since the last time Opera checked, Opera bolds the Bad Attitudes entry in my Mail panel and shows a count of new posts there. Email notifications and syndication updates are condensed onto a single panel. (Norwegian browsers rule!)

Comments and errors

I hope this brief introduction has been helpful. If you find errors or have suggestions for improving this document, please use the comment form below to let me know. Thanks!

You're welcome to use this form for private as well as public comments; but if you don't want your comments posted to this site, please say so explicitly. As far as I know, this form works in every case, unless you're running XP (and if so, why?). If you have problems with this form, send your comment to count_belisarius@earthlink.net.

All fields are optional.