minitutorials main logo the place to learn online

Sponsor This Site!
Sponsorship Details - miniTutorials is taking enquiries into various Sponsorship opportunities. Available NOW! Read More on our Sponsorship page.
This Page Sponsored by :
Proudly Sponsored by Your Company name here!
miniTutorials Sponsorship
Donate!
Consider donating to keep this site alive and up to date. Click on the Donate button to go straight to PayPal site and make a donation of an amount you choose.


More information on where the money goes on the Donations page.
Discussion Forums
visit the mini tutorial forums
For expert help and advice on any of our Tutorials or anything else .... visit the forums and ask away!!
Google Ads
My Profile

Details about the owner of this site can be found at :-

ohloh profile
View Gavin McDonald's profile on LinkedIn
Powered by a
UK2 Dedicated Server

RSS Feeds

Creating your own RSS Feed

feed the need

What you will need for this tutorial :

No other software is needed other than what you would normally use for the creation of your web sites. The only thing we are doing here is creating an XML page, uploading it to your site and waiting for the results.

a very brief history

There are it seems quite a few specifications (7 atm) and therefore different ways to code for RSS. The battle can be compared in style to Microsoft vs Apple, DVD- vs DVD+ , BetaMAX vs VHS and many more. It's a standards thing, Companies or Individuals wanting to turn their proprietry code into a world standard. As far as RSS is concerned there are 2 schools of thought and therefore 2 standards running concurrently. Version 2.0 - successor to the still popular version 0.91 - both created by Userland and based on the original specs by Netscape who invented it for their News Portal ventures. Another group split off and (before RSS 2.0) created an RDF version calling it RSS 1.0.

Ok, I'm not normally one for waffling on during a tutorial, but thought in this case we needed that brief explanation so we know what we are doing and with what version. By far the most popular is still 0.91 but far more versatile and standards compliant is it's successor 2.0. This is what we are going to be coding for. Last months tutorial on installing RSS Reader is compatible with all versions including version 2.0 so we can test our feed with no worries.

Top

Step 1 - the code template

Below is code based on the RSS 2.0 specification. If you are a Web Developer then you will recognise the style of coding even if you don't recognise some of the elements. The code is stripped bare of any information, we will fill this out as we go. Below is the bare minimum, like a minimum set of tags needed to create a normal .html web page, below is the minimum needed to create a successful and valid rss/xml feed.

<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title></title>
<description></description>
<link></link>
<image>
<title></title>
<width></width>
<height></height>
<link></link>
<url></url>
</image>
<item>
<title></title>
<description></description>
<link></link>
</item>
<item>
...
</item>
</channel>
</rss>

Thats basically it, our template for creating an RSS feed. All we need to do now is fill in the required details for our feed, save it and upload it as an xml file, create a link to it on our home page and we are done.

step 2 - fill in the blanks

<?xml version="1.0" ?>
<rss version="2.0">

The above lines tell the web server that we are using xml version 1.o as a language for this document and to reate it as such. And that we are adhering to rss 2.0 standards.

<channel>

The opening of our feed channel. You can have as many channels as you wish in an RSS feed, but we usually stick to one per .xml page. A channel is a subject of what the containing feeds are all about, so keep the feeds inside the channel related. The channel of course could be generalised such as miniTutorials site updates, the containing feeds therfore giving viewers various update news on the site.

We give our channel a title and brief description, this appears in Newsreaders as headlines, used to grab the viewers attention and whether they wish to open the channel to see what the feeds are within it. So as an example (all examples will conclude in a xml file at the end which we will test.)

<title>miniTutorials Test Feed</title>
<description>This Feed will contain all news and tutorials , articles added to miniTutorials site</description>

Next comes the link to our main site itself.

<link>http://minitutorials.com</link>

We then create and use an image to put in the feed, usually the main site logo, reduced in size if neccesary, we don't want a huge logo in a feed.

<image>
<title>minitutorials.com</title>
<width>140</width>
<height>130</height>
<link>http://minitutorials.com</link>
<url>http://minitutorials.com/images/minilogo1.gif</url>
</image>

Self-explanatory I hope, a title for the image, the width of the image, the height, a link where you want the image to take the viewer when clicked on and finally a url of where the image itself is located (or it wont be displayed.)

Ok, thats the neccesaries out of the way, now comes the feed headlines themselves - wrapped up in an <item></item> block.

<item>
<title>MTBrowser 2</title>
<description>MTBrowser opens up any web page in all your installed Browsers in one go!</description>
<link>http://minitutorials.com/apps/mtbrowser/index.shtml</link>
</item>

These feeds or items are the meat of the code, and what you add to or replace each time you update your feed. The above could be uploaded to a website and automatically anyone who has added the feed to their reader will get the new headline pop-up. Updating is just a matter of adding another feed item and uploading again. The reader will recognise it has been updated (via the last modified function I guess!) and download the new feed. So lets add another test feed item.

<item>
<title>This is an updated feed Item</title>
<description>Nothing to report as extra,nothing unususal, testing my image!</description>
<link>http://minitutorials.com</link>
</item>

Ok so it's not cutting edge news but I hope you get the idea. Finally we close any open xml file tags in the same way as a normal web page would be.

</channel>
</rss>

But we are not quite finished....

where can i find your feed?

Once completed, the above code needs saving and uploading to your webspace, validate it !! and then advertise its presence to the world by using an xml or rss (or both) image linked to the .xml file. Our feed is located at http://minitutorials.com/rss/feeds/minifeed.xml

You will find if you click on the link above directly that you will just get the code repeated back to you in the web page. Thats ok, you can check it against what we have gone through so you can see it is correct. Upload your feed when ready to your webspace. then we validate it to RSS standards, yet another web standard, but this is a good thing - and some RSS readers will ignore your feed if it is not valid. Visit http://feedvalidator.org and enter your url of the feed. If you followed the above exactly your feed will be valid. You can check if the miniTutorials feed is valid by clicking the logo : [Valid RSS]

Now, the standard way it seems of advertising your feed is by displaying either the rss link logo rss logo, the xml link logo xml logo , or both. I've put them here to save you looking, right click on them and save them, then upload them to your webspace and finally link them directly to the feed.xml file you have created.

As the feed.xml page you have created is valid, you can also follow the instructions at feedvalidator.org to display the rssValid logo on your site.

Top

 

Summary

Well, it's not that hard is it, but finding it out in the first place amongst all the confusion regarding RSS on the web is what took the time for me. I needed the right way, the most upto date, the most universally recognised and that it has standards - it is valid. Best part is, it is probably the easiest to work with. RSS 2.0 , Thank you UserLand!

Top

Want to know more?

Related Tutorials

RSS Install - How to install an RSS Reader to retrive RSS Feeds to your Desktop.
RSS Display - Display your own or other RSS Feeds on your website.

Related Links

Here are a few good links to more information. The above was to get you going, there is a hell of a lot more to RSS than I have even touched on.

http://www.rssboard.org/rss-specification
http://feedonfeeds.com/
http://searchenginewatch.com/about/article.php/2155721
http://webreference.com/perl/tools/

 

tutorial sponsors logo

About Us | Site Map | Privacy Policy | Contact Us | ©2002 - 2007 miniTutorials.com