AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
WebDevTips Pick Of The Day : Easy Maintenance With Server Side Includes |

Print This Page

You are here : Home - Web Development - Headline Syndication - Creation

Create your RSS file

Creating the file

Your file is in the RSS format, which is the most commonly used format for news feeds. The file is just plain text and is similar in appearance to an xml file. Here is an example

01 : <?xml version="1.0"?> 
02 : <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" ""> 
03 : <rss version="0.91"> 
04 : <channel> 
05 : <title>The Site Title</title> 
06 :   <link>http://the-site.url</link> 
07 :   <description>A description of your site</description> 
08 :   <language>en-us</language> 
09 : <item> 
10 :  <title>Headline Text</title> 
11 :  <link>http://headline.url</link> 
12 :  <description>A description of the item</description> 
13 : </item> 
14 :  </channel> 
15 : </rss> 

Let's look at it line by line.

01 : define the xml version.
02 : set the DOCTYPE (Document Type Identifier - required to ensure document validity)
03 : open the rss tag and declare the version
04 : open the channel tag
05 : the name of the channel
06 : the url for the channel (if you don't have a specific news page then your homepage will do)
07 : the site or news category description (what someone can expect to find if they follow the above link)
08 : the language of the page (check here for your language code)
09 : begin a new item/headline
10 : the title of the item/headline
11 : the url to the full item
12 : a brief description of the item
13 : close the item
14 : close the channel
15 : close the rss tag

The above example contains only 1 item/headline. To add more items repeat lines 09-13 - they must be placed AFTER the language tags and BEFORE the close channel tag. The new block must follow the same pattern as lines 09-13.

To make life easier we have written an rss code generator that will allow you to create your feed with up to 10 headlines.

Go To Step 2.

[index] [Step 1] [Step 2] [Step 3] [Step 4] [resources]

Why not discuss this article in our forum?
Get your questions answered quickly.

updated 26-Apr-2003


[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]