Knowledge 知識 : Web Feed
What is a web feed (RSS/Atom)
First, a note on terminology. The terms web feed and RSS are sometimes used interchangeably. Technically, RSS is a type of format used for web feeds. On this page, I'll try to keep that distinction, but in general, for information on web feeds, often times you can find it by using the search term RSS.
There's a good deal of information on the Internet about web feeds. For instance, here's the Wikipedia entry on web feeds, and here's another introduction to web feeds.
When initially reading about web feeds, I found that many websites did an adequate job of describing what web feeds were, but not clearly indicating what they are good for and how to use them. So here's my quick take on web feeds.
Web feeds are kind of like one-directional email, from websites to you, the user. A website will have a feed that you can subscribe to using a feed reader, which is somewhat like an email reader like Outlook or Thunderbird. Once you've subscribed to a feed, whenever new material appears on the website, it will be added to the feed, causing it to appear in your feed reader, similar to an email message.
Why is this useful? One, it makes it easy to see what's new and what you haven't read yet on a website, which isn't always easy to see from the website itself. For instance, if you subscribe to CNN's news feed, you'll receive a feed item (similar to an email message) for each news article CNN posts, and your feed reader will mark which ones you've read already.
Two, reading your feeds through a feed reader saves you the hassle of remembering to visit each individual website. For instance, if you're interested in a particular blog that updates on an infrequent basis, at some point you may forget about the blog and no longer check its page. Using a feed reader, you simply subscribe to all the websites' feeds you're interested in, and you'll be notified of any new material on any of the sites as soon as they're available, without the hassle of individually visiting each site.
Often, websites will explicitly have a link on their webpages to their web feeds. This is particular the case for larger news websites like the New York Times or CNN, who have feeds for each category of news; for instance, this is the New York Times RSS page, and this is the Economist RSS page.
If there is no explicit link, you can look in the address bar of your web browser and look for an icon like this:
For feed readers, I recommend using Google Reader. It's got a nice interface, loads quickly, and is an online reader so you can log into it with all your settings preserved from any web browser.
How to manually set up a web feed
There are a few different standards that can be used to create web feeds. The older standards are RSS, and a more recent standard derived from RSS is Atom. I prefer Atom for the sole reason that it allows you to input html and xhtml directly into the feed, as opposed to RSS, which requires you to use escaped html (e.g. typing in < whenever you want <).
If you want to completely know the ins and outs of Atom, you can read the entire specification. Fortunately, there's also this shorter introduction that goes over the basics, which was enough to get me started.
I was going to add my own short introduction to Atom, but then I came across this page that pretty much covers what I was going to write. The one thing I will add is that if you want more details on the date/time format for the updated field, you can find them here.
After you're done setting up your feed, there are a few more things you can do. First, you'll want to set up your webpages so that the associated web feed is autodiscoverable (i.e. the RSS icon will appear in the address bar of the browser to indicate to the user that they can subscribe to the page's web feed). To do that, just enter the following code in the <head> section of your webpage:
<link rel='alternate' type='application/atom+xml' title='Atom Feed' href='http://feeds.feedburner.com/garybhuang' />
Next, you'll want to validate your web feed to make sure there are no errors. Here is the W3C web feed (RSS and Atom) validator.
Lastly, if you're interested in tracking how many people visit your web feed, you can use FeedBurner. It can do other stuff for you as well, for example related to getting increased exposure for your feed. I haven't really played around with it too much yet though. Note that (unless I'm mistaken) it will take the address of your original feed as input, and then produce a new feed with an address like http://feeds.feedburner.com/garybhuang, so that is the feed address that you should give out for other people to subscribe to.










![Validate my Atom 1.0 feed [Valid Atom 1.0]](image/valid-atom.png)