Rules for Creating an RSS FeedBy Binny V A • 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.
Use RSS rather than Atom
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)));
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.
XML is not as forgiving as HTML – so make sure you validate your feed before releasing it upon the world.
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.