Common RSS Mistakes
10 December 2005, 17:36
The ubiquitous syndication format RSS is based on the XML file format, and as such has some strict rules that need to be followed to maximise its usability, to stick to guidelines, and even just make it work. Here are some common mistakes...
MIME type
MIME types are rarely an issue that a web developer comes up against, as it's often handled without user intervention by the web server software. Your standard Apache or IIS config will include mapping for common file formats to their MIME types. In Apache this will usually be done through the mime.types file and in IIS it's covered in the IIS Manager properties, or the properties of an individual website.
However, RSS is often served...
- Through a scripting language like PHP or ASP
- With an unrecognised and not configured by default format like ".rss"
- Without a file extension
In these cases the page is often served with a MIME type other than "text/xml" as it should be done. The result of this is that the page is displayed as plain text. Not a big deal, but not ideal.
The solution depends on how your generating your RSS feeds. If your generating them on the fly from a script then the fix is easy. In PHP use...
header("Content-Type: text/xml");
In ASP or ASP.net use...
Response.ContentType = "text/xml"
If your generating the feed to the server then you can just save the file with the file format .xml, then this (in Apache and IIS at least) will be served with "text/xml". If you can't save the file with this extension, then your going to have to find out how to set the MIME type correctly for the extension you choose.
Content in description
This one really gets on my nerves. The RSS 0.91, RSS 1.0 and RSS 2.0 specs clearly state that the description node should be filled with a "synopsis", or "brief description/abstract" of the item, rather than the whole content of the item. If you really want to stick the whole content in your feed then use <content:encoded> as described here. Arguably you shouldn't really put HTML in the description either. However nobody says you can't, I suppose.
Lack of links to the feed
You should advertise your RSS feeds in a couple of ways...
- Using the de facto standard bright orange button
- Putting the
<link rel="alternative">construction in every page on your site, or at least just your homepage
Not using <category> and <comments>
Not really a mistake, but people should definitely make use of these elements more. I see people putting comment counts, and category names in the <title>. Very annoying.
RSS Feed
about
Jason is a freelance web developer based in London.
My clients include numerous startups, Google, YouTube, FHM, Nickelodeon, Volvo & the BBC.
I also co-own Ferrago Ltd, who publish videogames content to around 7m consumers monthly.
links
me
- Flickr (photos)
- Facebook (social network)
- del.icio.us (bookmarks)
- last.fm (music)
- Linked In (business social network)
- Twitter (microblogging)
- Google Reader (bookmarks)
colophon
- Built in ASP.net using a Mac and TextMate
- Hosted on Windows, with IIS & MySQL
- Activity feed by FriendFeed
