Share Your RSS Content
Jason Cook May 14, 2003
Have you ever noticed those inviting orange buttons on some Web pages, or spotted the odd link pitching an "RSS feed"? If you've ever clicked one out of curiosity, and then scratched your head at the unformatted gobbledygook in your web browser, you've seen an RSS file.
What is it really for, anyway? Two things: RSS (Really Simple Syndication) is an easy way for sites to share headlines and stories so that other sites can integrate them into their pages. Additionally, some savvy surfers use special RSS aggregators — kind of like mini-browsers — to speedily flip through the latest news and links from dozens of sites.
In other words, Web builders use RSS to dish out and bring in fresh news and content on their websites, just like the big portals. And Web surfers can use RSS applications to collect custom-tailored selections of their favorite websites to be read at their leisure.
RSS gained traction among small developers years ago, because it's easy to code and simple to share. Today, RSS is gaining momentum with big commercial sites because the technology draws in a smart and growing audience.
So, do you need to publish RSS on your site? Who's really using and reading RSS? And should you download an RSS aggregator?
This brief how-to will answer those questions one at a time, and then provide a walkthrough of a no-frills RSS feed — one you can build for your site in just a few minutes. We'll conclude with some tips on publicizing your RSS feed and automating the feed-building process.
So, intrepid RSS-ers, let's get hacking.
Feeding Frenzy
First, a question of necessity: Do I need to publish RSS feeds for my site? Probably not. Truth is, most sites don't need an RSS feed.
RSS was made to share things like headlines, links, and story excerpts — hence its popularity with news sites and bloggers. If your webpage hardly changes from month-to-month, there’s really no pressing need to publish your own RSS feed. However, you might consider integrating content from relevant external RSS feeds onto your page to freshen things up.
But you don't need to be the AP Newswire or an online Samuel Pepys to get good use out of RSS. RSS can spread the word about a band's tour dates, corporate league sports schedules, civic functions, snow reports, real estate listings, university lectures, software updates, et cetera. If you semi-regularly update content on your website, building an RSS feed is (as advertised) Really Simple, and provides a worthwhile way of delivering your content to your readers.
Who's making and reading RSS?
Well, all the "cool kids" are doing it — Bloggers and technophiles, by and large, have been the main publishers and consumers of RSS for the past few years. These crafty folk are often the vanguard of larger Internet trends even if they are a small slice of the Web demographic as a whole.
You may be asking yourself, if it's only the cool kids who are into this whole RSS scene, should I bother with downloading an RSS newsreader? The answer is simple: Absolutely! For starters, try something like NetNewsWire for the Mac or AmphetaDesk for Windows, Mac, or Linux. Give RSS a spin for a few days and you'll be hooked.
RSS apps bring a wide selection of bespoke news to your desktop without requiring you to wade through links and bookmarks. Generally free of layout code, heavy graphics, and advertising, RSS feeds download quickly. Plus, RSS uses simple code, so it's available no matter what kind of device you're using. For example, I often lack access to telephone lines when I'm on the road, so I use my Bluetooth cellular modem and NetNewsWire to keep in touch with my favorite sites.
Test-driving an RSS reader is also the best way to understand what the RSS scene is about. Take a look at who’s talking: Bloggers dominate the list of syndication sites at Syndic8.com and NewsIsFree.com, but tech heavyweights like MSDN, Apple, and Oracle offer feeds, too. Major news outfits like the BBC and Christian Science Monitor also provide RSS feeds of their stories, some even on a section-by-section basis.
Neat, eh? Next up is a brief overview of RSS, touching on some of the confusion which has surrounded the format. If you prefer code to controversy, feel free to skip school — you can jump ahead and start making a feed for your own site.
The RSS Rope-a-dope
Unfortunately, a couple of things about RSS aren't "Really Simple" — namely, the history and politics. There are different versions, divergent formats, and even disagreement as to what RSS stands for: Along with "Really Simple Syndication," you'll spot "RDF Site Summary" and "Rich Site Summary".
Ugh! Our advice is to not dwell on these details when you're getting started.
In this introductory tutorial, we will build a sample RSS file in the widely-supported 0.91 format. While the 0.91 format is admittedly cruder than some newer versions, it's super-easy to understand and it gets the job done. Not coincidentally, it also happens to be the most popular type of RSS. Version 0.91 is also the best foundation for migrating to RSS 2.0, the latest format born of the same company (Userland Software) behind the 0.9x versions. RSS 2.0 extends the simple 0.91 format with some handy new elements, and via support for optional modules to carry metadata.
RSS 2.0's competition, if you will, is RSS 1.0. Version 1.0 is a totally separate standard created independently of the 0.9x and 2.0 efforts by a non-commercial working group. The 1.0 standard is not compatible with RSS 0.9x or RSS 2.0.
What's the big difference? RSS 1.0 was designed around the W3C's RDF (Rich Data Format) standard. Now, RDF is heady stuff, a metadata standard that's championed by those idealists interested in creating a Semantic Web. For your average HTML hacker, though, RDF markup is more complex, requires more bandwidth, and is just generally harder to grok.
As of press time, the tried-and-tested RSS 0.91 feed format remains the most popular, accounting for fifty percent of the feeds listed on the popular RSS directory Syndic8.com. Only twenty-five percent of feeds are offered in the RSS 1.0 format, while the other twenty-five percent are split between RSS 2.0 and other 0.9x versions. Rough-and-tumble debates have raged over which format is best, but truth is, today's quality RSS aggregators and tools handle most every flavor of RSS.
But like I said, that's all history and politics. Let's get started coding and see what-all's in a simple 0.91 RSS feed.
Inside a Feed
Here's an adapted version of Wired News' 0.91 RSS feed, including just the most basic of RSS elements, and links to two stories:
<?xml version="1.0" ?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>Wired News
</title>
<link>http://www.wired.com/
</link>
<description>
Technology, and the way we do business, is changing the world we know....
</description>
<language>en-us
</language>
<item>
<title>
Techs Tangle With Privacy Regs
</title>
<link>
http://www.wired.com/news/medtech/0,1286,58468,00.html
</link>
<description>
The deadline has past for complying with the 1996 Health Insurance
Portablility and Accountability Act, a sweeping law designed to protect
the privacy of people's medical records. </description>
</item>
<item>
<title>
SARS Gene Sequence Unveiled
</title>
<link>
http://www.wired.com/news/medtech/0,1286,58481,00.html
</link>
<description>
Scientists have uncovered the genome sequence for severe acute
respiratory syndrome, which may help develop better diagnostics.
</description>
</item>
</channel>
</rss>
What do you see? Some funny-looking tags, perhaps, but it's a lot like HTML and XML, isn't it? Since RSS is an application of XML, RSS feeds must be built as well-formed XML — so when you open a tag, remember to close and nest it properly. Sloppy code won’t work here.
The XML rigmarole likewise requires the first two lines, first defining the XML version and then setting a Document Type Definition. If you don't know what that means, no worries. Just cut and paste those opening lines, they're the same for every 0.91 feed.
Next in line is general information about your site, or metadata. Roughly akin to the <head> of an HTML file, this portion of the feed stays the same as updates are added. Here's where you can start replacing tidbits to tailor it to your site.
Here’s tag-by-tag commentary:
<RSS>: This opening tag includes a mandatory version attribute. Note that the </rss> tag also concludes our feed.
<channel>: The channel is the fundamental container for all RSS data — there's only one channel in a feed. Note that the channel tag gets closed near the very end of the feed, too.
<link>: The URL for the webpage that corresponds to the RSS feed. (Most likely, this is your homepage's URL.)
<title>: Hey, the title! This is most likely going to be the same title as your homepage.
<description>: A brief description of what's in this feed, or the purpose of your site.
<language>: This states what language your feed is in. "en-us" is American English, but as the complete list of allowable <language> values shows, there are several English variants along with a myriad of other languages.
Now, onto the <item>s — the dynamic headlines, links, and content you'll be syndicating. When you update your site and add new stories, new items are added to the RSS feed. Each <item> represents a separate story or content update. Up to 15 items can be included in RSS 0.91.
<item>: This wrapper tag is required around every item
<link>: The URL of an item.
<description>: A synopsis or excerpt of the item, although you're free to publish the entirety of the item here, as is many peoples' practice.
Two pieces of advice to heed while creating your <description>: Firstly, put in the extra effort to create a well-written, easy-to-read description. In the text-centric world of RSS, you can't expect an audience to click through to your site if your "teaser" excerpt has little appeal or sense to it. Secondly, if there is HTML code in your description, XML parsers throw a fit unless certain HTML symbols (like the ampersand) are escaped out. Either keep HTML out of your description altogether, or encode it via CDATA, like so:
I would <![CDATA[<b>really</b>]]> rather have just dropped the bold tag.
And that's it. Done!
Next, let's validate and automate.
Automatic for the People
To ensure your feed is properly formatted, run it against an RSS validator. The validator provided by Userland is a good place to start. There's also a validator at feeds.archive.org that handles a variety of RSS versions.
Our example on the previous page is a bare-bones RSS feed. Even in old-school version 0.91, there are plenty of other, optional tags you can include if you wish. You can specifying things like language, publication date, and copyright. Be sure to real the official specification for RSS 0.91 to get the full details.
A quick aside: After things click for you with 0.91, you might consider upgrading to 2.0 or making a separate 2.0 version of your feed. Technically speaking, it's only a matter of copying your 0.91 code and making a two-character change: Just change the <rss version="0.91"> tag to <rss version="2.0">. Version 0.91 is upwards compatible with 2.0, so any valid 0.91 feed is automatically a valid 2.0 feed. There are additional options available in the 2.0 format — such as the the "guid" tag, a globally unique ID that's ideal for weblog permalinks — that make 2.0 a worthwhile upgrade.
Of course, the RSS file you've created needs to be updated each and every time you add content your site. To avoid the dull and error-prone task of updating RSS feeds manually, most Web builders use automated tools to update their RSS. Content-management systems like Blogger, Radio, and MovableType all feature starter RSS templates and tools. The new Tripod Blog Builder tool offers a one-click RSS 2.0 generator. How handy! And we're not saying that about Tripod just because it is one of our sister sites (Terra Lycos is the parent company of Webmonkey, Tripod, and Angelfire).
There are resources on the Web which hand out free scripts and tools that you can use to spice up your RSS. Webreference offers a Web-based form that helps automate the RSS-building process. Webdevtips.com has a nice Web form, too. Additionally, a number of simpler server-side scripts to create RSS are available in PHP or another language of your choice.
Now that your RSS feed is all dressed-up, let's announce its availability to the world. Debutante ball, anyone?
RSStepping Out
After uploading your RSS file to your server, you'll still need to inform people of its existence. When you create a new feed, running through these few steps will debut your feed in style:
- Advertise to Web surfers! Put an XML button or text link on your page, linking to the RSS file. This [XML] button is the widely-recognized graphic for RSS feeds, though variants and remixed designs are generally just as recognizable. Go ahead, right-click, Save as...
- Advertise to the machines! Most RSS applications (and some search spiders) will automatically determine your feeds' location when you put the following code in the <head> section of your homepage: <link rel="alternate" type="application/rss+xml" title="RSS" href="url/to/rss/file" />
- Get listed by the major feed directories! Syndic8.com and News Is Free are two of the biggest collections of RSS feeds. Before advertising yourself to these sites, though, run a final test against an RSS validator. While Web browsers will render many poorly-coded Web pages, RSS parsers can be less forgiving, and require a well-formed XML file to work with.
Of course, there's always more to discover, if you are so inclined. Solid RSS tutorials have been written by Mark Nottingham, Fagan Finder, and Danny Sullivan. We'd be remiss not mentioning WebReference.com's large RSS library, and the surprise entry from the State of Utah which provides a great introduction to the subject. Lastly, of course, there's a definitive dead-tree resource from O'Reilly press, covering RSS in depth, not to mention a special RSS DevCenter site.
Happy feeding!
|