Bin-Blog logoBin-Blog

Learn about the latest in Web Development – as soon as I do.

Rules for Creating an RSS Feed

By • Jul 17th, 2008 • Category: Opinion, Web Development, XML

Most of us don’t have to worry about creating an RSS feed for our sites – the CMS tool will do that automatically. But there are times when you are creating a custom application – when you have to create an RSS feed yourself. Creating it is easy – they don’t call it Really Simple Syndication for nothing. But there are a few rules(or rather, guidelines) that are ignored by most – make sure you follow them.

I am by no means an expert on this format – but I have created RSS feeds and have worked on applications to parse it. So I have seen my share of bad implementations.

Use RSS rather than Atom

I prefer using RSS as opposed to the Atom format. But Atom is now supported on almost all feed readers – so this preference may change. But for now, I like RSS better than Atom.

Last-Modified

Make sure your feed has the last modified header. This will prevent unnecessary downloading of the feed if there are no new articles. It saves both the site’s and the user’s bandwidth.

This is extremely easy in PHP…

$last_edited = '2008-07-17 01:02:03'; // This should be the time of the latest post.
header("Last-Modified: " . date('r',strtotime($last_edited)));

10 Posts

Make sure you provide a limited number of posts in the feed – the perfect number, in my opinion, is 10. It can increase or decrease a bit – its no big deal. If your posting frequency is high, the number should increase. And if the frequency is low, the number of items in the feed can go down.

But make sure that you are not including all the posts from the beginning of time until now. This is a big waste of bandwidth. Unfortunately, many have adopted this method. For example, take this feed – Cat and Girl Comic feed.

The other extream is just as bad – providing just the latest item in the feed. If the author writes two posts in quick succession, the viewers may not get an article. An example for this in the subnormality comic.

Validate it

XML is not as forgiving as HTML – so make sure you validate your feed before releasing it upon the world.

Use FeedBurner

When it comes to deployment, using FeedBurner is a better option that using your own server. In addition to its statistics, it will also act as a CDN lowering the load on your server.


5 Responses »

  1. Mayooresan says:

    //Validate it//
    Thanks for dat awesome tip!

  2. Niyaz says:

    Thanks for that tips Binny.
    I guess the code snippet in PHP will come handy.

  3. Simon Scarfe says:

    Hi Binny,

    Why the preference of RSS over Atom? Most vs-articles I have read mark Atom as the superior format. Either way, I’m of the opinion that both are ubiquitous, just choose one over the other – using both only serves to confuse people.

    Si

  4. Binny V A says:

    @Simon
    Even I am not clean on why I choose RSS over Atom. But I have been working on this for some time – and I have found that RSS is more simpler for me to use – so I prefer it. It may be due to my lack of experience with Atom. As I said in the article, my preference my change anytime.

  5. […] I always liked RSS – we have been good friends as kids. Yes, RSS is the name of an Indian Political Party(IPP) – but I cannot hold that against RSS. Its not its fault that some politicians took its name as well. For my readers who are not Indians(Really? I got international readers? I thought it was just me and my mother), RSS(Rashtriya Swayamsevak Sangh) is a famous party in Indian. You must have at least heard of one of its members – Nathuram Godse. Yes, he is the guy who shot Mahatma Gandhi. And he was a member of RSS. To be absolutely fair, he left RSS before he shot Gandhi. So, in summary, RSS is a famous Indian Political Party. And it is not the RSS we are talking about. […]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>