How to add RSS 2.0 feed to a web-site?


wiseGEEK Writing Contest

Really Simple Syndication (RSS) is a web site information syndication format written in eXtensible Markup Language (XML). Commonly known as RSS feeds, this is a method to inform web site subscriber about the availability of new content on your web site. RSS feeds are generally added to web sites that update content regularly, such as: articles, news, blogs, etc. The web site visitor will subscribe to the web site RSS feed by clicking on the RSS feed button or link on the web page. The common format for RSS feed button is small orange rectangle with 'RSS' or 'XML' embossed over it.

Do you need to install web content publishing system on your web site in order to add RSS feed?

No, instead you can write a simple RSS XML file and upload it to your web site. Once the format is ready, it must be updated every time you add a new content to the web site. The difference is that a publishing system will automatically add new content information to the RSS feed. Here is the method to manually add simple RSS feed to a web site.

Sample RSS file

?xml version="1.0" encoding="ISO-8859-1" ? rss version="2.0"

channel: title: web site name link: web site URL description: Description of web site item: pubDate: date of content publication title: Anchor Text link: Anchor link description: synopsis, that must inform the reader about the web content. guid: Anchor Link

Explanation of the sample RSS file

Line 1: specifies XML version and encoding scheme. Line 2: Start tag for rss element with attribute version that gives RSS specification version for this RSS document.

channel: Every RSS 2.0 document has one channel element that can contain more than one item sub-element. The channel element has some sub-elements that describe this channel. The basic minimum requirement is to include these three sub-elements: title, link and description. title: Enter the title for the RSS feed, this may be your web site name. link: Enter the link for the title name given, this may be your web site URL. description: Enter the brief description for the RSS channel, write a sentence about the information that will be published by this RSS feed.

Line 4, 5 and 6 information is entered only once, unless you want to change it. You can now add items in the channel. Suppose you have recently added two new articles to your web site, hence there are two items to be syndicated. Do the following for each item:

pubDate: The date when article has been published. If this date is ahead of current time or in a wrong format, the validator will return error. Correct date example: Sat, 21 Apr 2007 12:00:57 GMT . title: The anchor text of the article. link: The URL for the article. description: A summary or initial few lines of the article that may generate reader interest. If you publish the complete article here then the reader may not visit the article URL. guid: Must have same value as link.

Save this file as a text file with .xml extension, such as: sample.xml .

Validate your RSS file

Upload the file to a web server. You may upload it to the web hosting server that hosts your web site. If your web site URL is http://www.domainname.com then the URL for this file may become: http://www.domainname.com/sample.xml . Now enter this URL to feed validator for validation of the syntax in the file. Validator will tell you if there are any errors. When file has been validated it is ready for installation.

Install RSS feed

File is already uploaded to your web server. Add a link to this RSS feed to your web site by adding following HTML code lines or any other reference figure/text: a href="http://www.domainname.com/sample.xml" img src="http://www.domainname.com/rss.gif" /a

rss.gif or xml.gif are the RSS/XML button picture respectively, you may make one or download from internet.

Feed indicator: The web browser has a RSS feed present indicator button on the tool bar, this button glows orange when a web page with RSS feed is viewed. This informs the reader that an RSS feed is available and the reader can subscribe to it in order to be informed about new web content. To enable RSS feed present indicator on your web page add the following line to the head tag in the web page HTML code with right “web site name” and XML file URL. link rel="alternate" type="application/rss+xml" title="web site name" href="http://www.domainname.com/sample.xml"

Update RSS feed

Now you have successfully added RSS feed to your web site. You can update it as often as you publish new content on your web site. The steps required to update the RSS feed are: - update the item element in the file for new content. Remove obsolete/empty item elements. - copy it to a temporary location on your web server say: http://www.domainname.com/test/sample.xml - validate the new .xml file, enter the file address in the feedvalidator box. - copy the validated file to original location: http://www.domainname.com/sample.xml . Note: you must validate the file from a temporary location before publication. The moment the file is copied to the address given in "Install the RSS feed" section it is published and readers may receive the notification for the new content.

Get statistics

You can collect statistics about the RSS feed subscribers by submitting it to web sites like FeedBurner.

You can add HTML coding to the description in your RSS file. You can add more than one RSS feed for different web pages or content type by creating separate RSS XML file for each.

submitted by Ila Nivas