BBC radio 2

Did you hear our how to guides on Simon Mayo's Radio 2 Drivetime show?

You may have read about Howopia in The Telegraph?

How to code an RSS feed

5
Your rating: None Average: 5 (1 vote)
RSS feeds are an excellent way to keep your online audience updated with new material on your website. RSS tends to be used by news sites, e-mags and blogs, or any other regularly updated, text-based webpages. RSS, as is suggested by the name (Really Simple Syndication), is extremely easy to set up and maintain. The feed - or channel - uses XML code, so can be written using any standard HTML, xHTML or XML programs, as well as simple word processors, such as Microsoft Notepad. The feeds are usually labelled with the recognised orange RSS icon (pictured), or the word "Subscribe", which, when clicked, leads the user to the feed page, which is automatically created by code reading software. The contents of the feed can be read on this page, but the general idea of an RSS channel is that users subscribe to the feed using an RSS Reader, such as Google Reader. I personally use Live Bookmarks on Mozilla Firefox. This guide demonstrates how to code an RSS feed that will be viewable in all web browsers designed since 2006 (the year that RSS really took off).
What you'll need: 
PC or Mac computer
Microsoft Notepad or a similar word processor
Internet access
Access to an http or ftp server
1: 
Open a new document/page in your chosen program. To simplify this process further, Microsoft Notepad will be used in this example (as it has no colour coding, or automatic code functions), but the coding is exactly the same in all programs.
2: 
To convert all of the code to XML, and force the page to take on the characteristics of RSS channel, type the following: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> </channel> </rss>
3: 
Now that we have the basic template of the channel, more information can be added, if desired. The channel itself can be given a title, a description, a link (to the main site), and original publication dates. All of this information should be inserted between the two channel tags. An example being: <channel> <title>How to code an RSS feed</title> <description>A guide to coding your very own RSS feed</description> <link>http://howopia.co.uk</link> <pubDate>Sat, 11 Sep 2010 15:00:00<pubDate> </channel> Once uploaded, at the top of the RSS channel, there will now appear a bold title - How to code an RSS feed - with the description on the line beneath in smaller, lighter font, along with the date and time. The title will link to howopia.co.uk when clicked.
4: 
Now we have all of the general channel information, we can add items to the feed. It is the items that are read by the user, so each item should signal the addition of new material to the site. The code for each item should also be placed between the two channel tags, after the channel information where relevant: <pubDate>Sat, 11 Sep 2010 15:00:00<pubDate> <item> <title>Step 1</title> <description>Open a new document in your chosen program...</description> <link>http://howopia.co.uk/thisguide/step1</link> <pudDate>Sat, 11 Sep 2010 15:05:00<pubDate> </item> </channel>
5: 
Each new item can now be added to the feed using the same format, just remember to encase each item in the item tags: <item> </item>. If you want the item to appear at the top of the feed, then it should be coded above the previous items, and should be added afterwards to appear below. There is no limit to the number of items one feed can display.
Conclusion: 
Save the file and upload it to your http or ftp server, with the suffix .xml or .rss. Provide a link from the main page of your site (the RSS logo can be found by serching for "RSS icon" online), and you are good to go.
Tips: 
Spread out your code so that it is easy to read, this will help with spotting mistakes, making changes, and deleting sections when they are no longer needed.
Regularly upload your code to check that it is working as it should.
Check your code on a number of different web browsers, not just the one that you use.
Do not make your item descriptions too detailed, the RSS is designed to give the reader a taste of something bigger, and the link should lead them to the full article or page.
Warnings: 
Remember to place all of your code between the relevant tags.
Do not miss off brackets < > or the code will not work.
It is best to stick to the cases used in the examples above, as some reading software will interpret CAPITALS differently to small case letters within the brackets < >.

Comments

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Featured writers

We have had a chat with a couple of our more experienced writers.

Find out more about their experiences and why they contribute to Howopia.

Spotlight on two writers.

Share this


How To guides

Howopia is a new website dedicated to bringing together a community of experts to create the most useful 'How To' guides, to help you to achieve almost anything.

Related links