Creating Your Own RSS Feed

Updated on 01-Jun-2005
RSS stands for Really Simply Syndication, and allows you to do just that-distribute headlines and other Web content.

A family of XML file formats for Web syndication, RSS is used by news Web sites and Web slogs. With Firefox clocking nearly 50 million downloads and incorporating native RSS feed support, no Web site or blog owner can afford to ignore the power of RSS (kindly ignore any political connotation)!

There are many Web sites (for instance, www.feedforall.com) that do it for you for free. But if you are the do-it-yourself technology buff (we know you are dear reader!), we will teach you how to create your very own RSS feed from scratch! As they say, no pain, no gain!

The Essentials
You need to have a simple text editor, (even notepad will do the job), and of course, a Web site or a blog!

The Code
There is no need to  feel apprehensive at the mention of the word ‘code’, it’s extremely simple and if you know HTML, it’s ridiculously easy! Here is a sample of a simple RSS Script-
<rss version=”2.0″>
<channel>
<title>Nutswork:Latest Stuff
<link>http://www.nutswork.net
<description>Ferrari News
<image>
<title>Ferrari News
<url>http://www.nutswork.net/logo.gif
<link>http://www.nutswork.net/
</image>
<item>
<title>Imola Race Results
<description>The Race Results for the 2005 San Marino Grand Prix
<link>http://www.nutswork.net/f1/2005/imola/race.html
</item>
</channel>
</rss>

Understanding The Tags
The first tag is the <rss> tag, where you specify the standards of coding to which the script conforms. We will be using the latest standard-‘2.0’.

The second tag is <channel>. This tag incorporates all the data of your RSS feed. The and tags tell the feed reader the topic your feed pertains to, and the Web site with which the feed is associated.

All tags discussed so far are mandatory but the <image> tag is optional. If you don’t put this in your RSS file, you will simply get a text-only feed, which is ok but it’s better to have your Web site icon on the feed!

We now come to the part you will be editing frequently-the headlines you want visitors to notice! Every headline in your feed is wrapped inside the <item> tag.

Inside, you have the <title> tag. Whatever you put in here will be seen by subscribers to the feed. If you have used the RSS feed reader in Firefox, then it’s the content in this tag that’s visible when you click on your bookmarks.

Next, you have the <description> tag. This is a brief description of the article that the tag, the link of the article. Finally, you have the closing tag for the headline as . You can also repeat the tag for as many items as you want, to get as many headlines you require.

Every time you would like to add a new headline, just add a new <item> tag on top of your earlier

tags. See to it that you don’t add too many headlines without removing the earlier ones as this could make your feed too big and slow it down.

Optional Elements
So far, all the aforementioned elements are required for your feed to work properly. There are quite a few elements that you can add. Consider, <author>. You can put your email address in this tag.

Similarly you can have <pubDate> to signify the publication date. At the same time, keep in mind that the date must conform to the time specifications of RFC 822, i.e., it should be in the following format:
Sun, 22 Aug 1983 00:00:01 GMT

Adding It To Your Web Page
Since RSS is essentially an XML (eXtensible Markup Language) file, we need to tell the RSS reader as much. Hence, you should add the following as your first and foremost line in the document:
<?xml version=”1.0″ encoding=”utf-8″ ?>
Note: This tag is not closed in the end i.e., there is
no </xml>

Next, you need to save this file with an xml extension. Say, myfeed.xml
Now that your feed is ready, your next goal is to tell Web browsers that it exists! So you need to incorporate the following lines into the <head> tag of your Web page-
<link rel=”alternate” type= “application/rss xml” title= “My RSS Feed” href= “http://www.nutswork.net/myfeed.xml”>
Whatever you put in the title= ” ” field is displayed when someone clicks on your subscribe button.

That’s all there is to it really! Your RSS is ready to roll! Or should we say, you can now Roll Your Rss!

If you have incorporated it in your Web page header, then you need not worry as compatible browsers will detect it automatically.

However, for users of IE (since IE does have an in-built RSS reader), you need to show them your feed.

To do this, you can download any of the available RSS or XML images available online, and put the location of your RSS file as the image link.


Team Digit

Team Digit is made up of some of the most experienced and geekiest technology editors in India!

Connect On :