Podcast XML



Chris Young's Profile
Chris Young's Facebook Profile
Create your badge

Adding an RSS Feed

RSS logoIf you have a site which has a lot of new content added on a regular basis then adding an RSS feed is a great way to not only get more people to view your content but also a way to generate more inbound links.

I have just created 2 RSS feeds for AnswerHero.co.uk:

An RSS feed is an XML based file in a specific format that is recognised by the plethora of RSS readers out there.
You can even use services like TwitterFeed to automatically post entries from your RSS feed into Twitter accounts!

Setting up the feed is fairly straightforward and involves writing out a header section and then looping through the required records and writing them to the feed.

RSS Header Section

If you look at the source of one of the feeds above you will see that the header section looks like this:

<rss version="2.0"><br /> <channel> </p> <link>http://www.AnswerHero.co.uk</link> <description>Visit AnswerHero.co.uk to ask a question about anything and<br /> view 1000s of answers.</description><br /> <language>en-gb</language><br /> <lastBuildDate>Sat, 27 Jun 2009 14:21:48 GMT</lastBuildDate><br /> <copyright>Copyright: (C) eneva.com Ltd.</copyright><br /> <image><br /> <url>http://answerhero.co.uk/images/logo.png</url></p> <link>http://www.AnswerHero.co.uk</link></image><br />

Everything in this section is hard coded except the LastBuildDate which is basically the current date.

Firstly you need to add this to the very top of the code: Response.Contenttype = "text/xml".
Next output the sections above until you get to the “lastbuilddate”.

I used the following ASP code to format the date using “now”:

response.write ""
response.write left(weekdayname(weekday(now)),3) & ", " & day(now) & " " & left(monthname(month(now)),3) & " " & year(now) & " "
If Hour(now) < 10 then
response.write "0"
end if
response.write hour(now) & ":"'
If Minute(now) < 10 then
response.write "0"
end if
response.write minute(now) & ":"
If Second(now) < 10 then
response.write "0"
end if
response.write second(now) & " GMT"
response.write "
" & vbcrlf
response.write "Copyright: (C) eneva.com Ltd." & vbcrlf
response.write ""
response.write ""
response.write "http://answerhero.co.uk/images/logo.png"
response.write " http://www.AnswerHero.co.uk"
response.write "" & vbcrlf

RSS Body Section

You then need to loop through as many records as you would like to go out in the feed, say 50, and write the following for each record:

response.write "" & vbcrlf
response.write "" & DESCRIPTION_FROM_RECORD & "" & vbcrlf
response.write " " & URL & "" & vbcrlf
vbcrlf
response.write " "
response.write left(weekdayname(weekday((mid(rs("DateTime"),7,2) & "/" & mid(rs("DateTime"),5,2) & "/" & left(rs("DateTime"),4)))),3) & ", "
response.write mid(rs("DateTime"),7,2) & " " & left(monthname(mid(rs("DateTime"),5,2)),3) & " " & left(rs("DateTime"),4) & " " & mid(rs("DateTime"),9,2) & ":" & mid(rs("DateTime"),11,2) & ":" & mid(rs("DateTime"),13,2) & " GMT"
response.write "
" & vbcrlf
response.write ""
response.write "
" & vbcrlf

RSS Footer

Then finish of the XML with the footer:

Allowing Auto Detection of the RSS Feeds

You know when you go to some websites you get the little RSS logo appearing in the browser?
Well you achieve this by placing entries in the head section of your pages.
If you look at the source of the AnswerHero home page you will see the following:

It’s as simple as that!

Once you have created your RSS feed just do a search on Google for “rss feed directory” and you will find plenty of places for you to publicise your shiny new feed.

Bookmark and Share
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MySpace
  • TwitThis
  • Webnews.de
  • Yahoo! Buzz
  • YahooMyWeb

Leave a Reply