Program an RSS Feed in XML

06.18.2012 by Ilia Raiskin
XML RSS

In this tutorial you are going to learn how to program a basic RSS feed with XML. RSS or Really Simple Syndication, is useful when you want to show a list messages for visitors with updates of your website. An RSS feed doesn't look the same in different Browsers. It is important that the structure is really simple. A standardized format for RSS is XML. Here you can see how an RSS Feed looks in Safari:

RSS-FEED

There is always a headline with a date and then a description with a link to the content on the website. This is a basic RSS Feed source code:

At the beginning of the feed you can define some information about it: <link> is a link to the website, <title> contains the title of the RSS feed, <description> contains a short description of the feed, <language> sets the feeds language and <copyright> contains copyright information. <image> defines an image that should be added to the feed-header. <image> is not required; not all RSS readers show it. It is advisable to use it for the RSS readers that show it.

The <item>-tag-blocks contain information to display the messages. One <item>-tag-block is one message. <title> is the title of the message which is usually displayed as a headline. <link> contains a link to the original article on the website. <description> contains a description of the update/message. <pubDate> contains the date of the message.

You also can link the RSS feed with html files. Some browsers will then show a small rss-icon in the url-bar. If you click on this icon the browser opens the RSS feed. Safari is an example:

safari - rss

This code snippet has to be placed inside the <head>-tag:


About the author

Ilia Raiskin

Ilia Raiskin is a web designer, web developer, blogger and founder of Toolinfy.com.






Comment