Hey, Happy Diwali people!
It was a long weekend at work (yesterday holiday), and I was quite happy to have one! Contrary to what you'd expect, though, I spent time yesterday and today doing a bit of coding on my site, and have constructed an RSS feed for it, which I will talk about in this extremely lengthy post. Don't worry though, our regularly scheduled programming (movies, drawings, etc.) will continue soon...
I've wanted to add an RSS Feed to my site for a very long time. But it's only been the last couple of months that I'd been seriously planning for it and thinking of ways to implement it, and I finally completed it today. Look to the left of the screen, below the menu there is an icon with "RSS" next to it, and if you are viewing this site on a browser that is capable of recognising RSS feeds, you should see the feed icon on the address bar itself.
But hold on a moment, let me take some time to clearly explain what this is about, and how I implemented it. You'll have to forgive me if some of this is very basic stuff though (and some of you must forgive me if this is needlessly complex). Also, the way I've coded it is probably not the best way to do it. But it was something interesting to do, and I put in quite some time into it, so I thought why not write an article on it.
What is an RSS Feed and why should I care?
If you're like me and you regularly follow a number of websites/blogs, you probably keep visiting them frequently to see if the authors have updated the content there. But then, if the list of these websites is large, you'd probably like it better if you could get a "summarised" view of all the updates on this entire set of websites, like below —
That's a screenshot from Google Reader, which is an aggregator. An aggregator (or "feed reader") is a website or a software program that provides such summarised information pulled from websites. How does it know what information to pull from a website? That's where an RSS feed comes in. You see, a few years ago, a bunch of guys came up with a method for a site to provide a summary of updated content, in the form of a simple XML file. This specification is called RSS (Really Simple Syndication). The way it works is, a website generates a summary of updates as an XML file conforming to this specification, and then aggregators simply peek at this file and generate the summary you see above. Sites that provide a summary like this can have their content syndicated by other websites this way, so it becomes another channel to get the content out there.
Building the RSS Feed for Karthik82.com
So, now we've established that we need to have an XML file formatted in a particular way and made available to anyone (an aggregator/feed reader). What is the format required actually? Look no further than the RSS 2.0 Specification page. As you can make out, the file contains the following items —
So, now, all we need to do is make sure that whenever an aggregator wants it, there is an XML file fomatted in the above way, with the relevant data, available. There are a few ways in which this can be done —
Now that I'd decided how to generate the feed, the next step was to actually decide how to pull the relevant data from my database tables and make it available in the feed. I wanted to have a chronological view of activity on the site, which means that not only should blog posts figure in the feed, even drawings, movie reviews, and most importantly, comments, needed to be there as well. I thought of a few ways to accomplish this, as well —
Whew! So now, you can have something like this —
Yay! That's Google Reader with a subscription to my site's RSS feed! The URL to the feed on this site, by the way is http://karthik82.com/rss so you can add that into your aggregator. That's not all. There is one more cool thing I did with this. I added this RSS feed to my orkut profile as well. When you visit my profile, you'll see a link called Karthik82.com on the left side menu, and on clicking it, you'll see something similar to this (click for a larger image) —
That's a summary of the updates on my site, accessible within orkut itself. You can add the feed link to any site or service that supports RSS syndication. A couple of people to credit: Krish Ashok, for the discussion we had the other day, he kind of confirmed that the direction I was heading in was the right one; Kartik Agaram for being a strong advocate of building an RSS feed; and Tobias Münch, for going ahead and building an RSS feed for his site, thereby inspiring me to do one myself (the headline, by the way, is a reference to this post on Toby's site, where he announced that he had created an RSS feed for it). I also picked up some info from these articles: this, this and this (the last one, by the way, is about the CDATA element in XML, which I used for the description field of every item, as the blog post content which is going to go into the XML file, has markup within it). Now I don't know how many people will actually use the RSS feed from my site, but hey, I learnt something while implementing this, and I can lay claim to building a completely customised RSS feed for my site. Feel free to give your comments below.
Dark Fate 2 is a singleplayer level for Doom II, replacing MAP01. It's a small-sized hellish level — and there's a walkthrough video as well.
27-year old Taurean (birthday 15-May-82), Assistant Manager - HR at Tata Consultancy Services Ltd in Hyderabad, India. Previously, did Post Graduate Diploma in Management from T A Pai Management Institute (2003-05) and before that, Computer Science Engineering from Sree Nidhi Institute of Science and Technology (1999-2003).
Email: karthik82 -AT- gmail -DOT- com
orkut profile
Facebook profile
YouTube channel
deviantART page
Google Reader Shared Items
Disclaimer: The views expressed on this site are purely my own.
Warning: This site occasionally contains profanity.