Author Topic: How to Create an RSS Feed With Notepad and a Web Server  (Read 7539 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
How to Create an RSS Feed With Notepad and a Web Server
« on: June 14, 2009, 12:47:57 PM »
How to Create an RSS Feed With Notepad and a Web Server

An RSS (Rich Site Summary) feed is an XML file used to describe the contents of your website. As your website content changes, your RSS feed changes. Other computer systems, known as 'aggregators' or 'harvesters', read your RSS feed everyt once in a while. If you have provided new information, the aggregator takes that information and sends it to readers around the world. Thus information about your site's contents is 'syndicated', that is, rebroadcast to a much larger audience.

Step One: Getting Ready

Notepad: an RSS file is a plain text file. This means it can be created with any ordinary text editor. Windows Notepad will do the job. You can also use Wordpad or even MS-Word. But you will have to be sure to save your file as plain text. Any formatting breaks the RSS file. Save in plain text only. I prefer to use a text editor called NoteTab. It is a plain text editor and never surprises me with unexpected formatting. http://www.notetab.com In Linux I use Bluefish. http://bluefish.openoffice.nl/

The server: if you have a website, you have a server. The server is where your website is located. You need to be able to load files to your server. If you can put your home page on your server, you will use exactly the same process for your RSS file.


Step Two: Find a Template

The easiest way to create an RSS file is to copy someone else's. You don't need to worry about this; you will be replacing all of their content, and the format of the file is freely licensed for use by anyone. Here is a short, simple template file you can use:

(Copy everything below this line, but not including this line)


Code: [Select]
<?xml version="1.0" encoding="ISO-8859-1" ?>
 <rss version="0.91">

 <channel>
 <title>OLDaily</title>
 <link>http://www.developers-heaven.net/forum/index.php</link>
 <description>OLDaily - By Stephen Downes </description>
 <language>en-us</language>

 <image>
 <title>Stephen's Web</title>
 <url>http://www.downes.ca/images/rss.gif</url>
 <link>developers-heaven.net</link>
 <width>90</width>
 <height>36</height>
 </image>

<item>
 <title>my title</title>
 <link>http://developers-heaven.net</link>
 <description>any description you want ....
 </description>
 </item>
 <item>
 <title>other title</title>
 <link>http://developers-heaven.net</link>
 <description>any description....
 </description>
 </item>
 </channel>
 </rss>

(Stop copying at this line. Do not copy this line.)

Take the text you have just copied and paste it into your text editor. Save this as a new file called (say) mysite.rss - you can call your saved file anything you want, but it is a lot easier if you indicate the name of your site and use .rss as an extension, just so people can tell by looking at the title what your file does. Remember to save the file in plain text format.   

Step Three: Defining Your Channel

Now look at the file you have just copied into your text editor. Near the top, notice that there is a line that says <channel>. The information following this tag, and above the tag that says </channel>, will be where you describe your website as a whole.

You need to enter four pieces of information. The information goes between the tags, where information about my site is currently located. Delete the information about my site and type in the information about your site. Specifically:


title: this is the title of your site
link: this is the URL to the home page of your site
description: this is a short description of your site
language: this is the language your site is written in (you need to use the official format for this, so if your site in English, just leave this line the way it is)

You only need to create this part once. You can change it any time you want, but you do not have to. Once this part is done, therefore, it is done forever. Take a sip of your beer. You've earned it.

Step Four: Your Image

This part of your RSS file is optional; you don't have to add an image if you don't want to. Your image will be used by some aggregators to provide some visual identity to your RSS feed.

You will need to create an image first. Use any image editor (I use PaintShop Pro - http://www.paintshoppro.com/ ). Your image should be very small: my image is 90 pixels wide by 36 inches deep. You can either create a new image for your site image or do as I did: use PaintShop Pro to capture a bit of the site that looks nice, then reduce it in size.

You can put your image anywhere you want, but I recommend uploading it to the same directory as your RSS file.

Then describe your image in just the same way you described your channel: by replacing my text and using your own.


title: the title of your image, usually the title of your website. This is often used as an image 'alt' tag.
url: the location of your image on the web. Use the FULL url, including the http
link: the URL people are sent to if they click on your image. This is usually the same URL as your channel link URL
width: the width of your image, in pixels
height: the height of your image, in pixels

As with the channel tag, once you've done this step once, you never have to do it again. This was a long step.

Step Five: Defining Your Links

Your site may contain one or more articles you want readers to read. This is the part that changes from time to time. For example, Technology Source publishes a set of eight or so articles every two months. So every two months, you need to change this list, to reflect the current contents of Technology Source.

Each article is described by an <item> tag. In the example above, I have included two items. You can see that the description for each starts at the <item> tag and ends with the </item> tag.

In between the item tags are some tags containing information about the article. To create information about an article, remove the information about my articles, and replace it with your own. If you have more than two articles, copy an article tag (everything between and , including these tags) and paste it below the second item, and above the </channel> tag. Then enter your content:


title: this is the title of the article
link: this is the URL of the article itself
description: this is a short summary of the article. Note that I use description to include information about the author and the date.

Create an item for each article. Then save your file.

Step Six: Escape Characters

Now we come to the trickiest part of creating an RSS file.

An RSS file is an XML file. Some characters are illegal in XML. So you have to 'escape' them, that is, insert a text string in their place. Here is the list I use (not all of these are strictly required, but using this full list ensures maximum safety).


& - replace all instances of '&' with the following: &amp;
- Don't forget the URL! Many URLs have ampersands in them.
- If a link element is http://www.mysite.com/index.cgi?n=4&p=5 then you must change it to http://www.mysite.com/index.cgi?n=4&p=5
" - change every full quote to &quot;
- For example: He shouted, "Fire!" becomes, He shouted, &quot;Fire!&quot;


' - change every apostraphe to &apos;
- For example: It's his bike. becomes It&apos;s his bike.

> - change every 'greater than' character to &gt; - but DO NOT change them in the tags.
- For example, <description> am > three feet tall</description> becomes <description>I am &gt; three feet tall</description>

< - change every 'less than' character tag to &lt; - but DO NOT change them in the tags
- For example: "<description>I have < five dollars</description> becomes <description>I had &lt; five dollars</description>

Step Seven: Uploading Your File

Upload your file to your web server. It is best to put it in the same directory as your home page, though you could place it anywhere you want.

You now have a working RSS feed. Congratulations.

Step Eight: Validating Your RSS File

Strictly speaking, this step is optional, but it is strongly recommended since it's easy to make a mistake on step six.

To validate your RSS file, go to an RSS validator on the Web and enter the full URL of your RSS file into the form. Click the button. If there are any errors, the validator will tell you about them. Otherwise, it will validate your file.

Here are some validators:


http://aggregator.userland.com/validator
http://feeds.archive.org/Fvalidator/

If your feed is valid, have a sip of your beer. Otherwise, correct the error and try again.

Step Nine: Advertising Your Feed

You need to tell people that your feed exists. They are not (necessarily) going to find it through Google. There are two major ways to do this.

First, add an XML button to your home page. An XML button is a little organge image that links to your RSS file. You've probably seen them on other web pages. Get a copy of the image (one is located at http://www.downes.ca/images/xml.gif ) and upload it to your website.Then place the image, with a link, on your home page. For example, place the following code on your home page:

Code: [Select]
<a href="http://www.mysite.com/mysite.rss"><=img src="xml.gif" width=36 height=14 alt="RSS feed for this site" border=0></a>

Second, you can submit your site's RSS feed URL to various aggregators. This will tell them to start checking your RSS feed for updates. Here are some aggregators:


Daypop: http://www.daypop.com/info/submit.htm
Syndic8: http://www.syndic8.com/suggest.php?Mode=data
Edu_RSS: http://www.downes.ca/cgi-bin/xml/feeds.cgi


Note: these are instructions for creating a basic RSS feed. The RSS standard can be extended in a variety of ways. But this is a good starting point: your feed will be fully functional, and most important, it will work. Get to know and love your feed. After a time, you may want to look at the world of RSS 1.0 and RSS 2.0 and the various ways to add more information. When you add functionality, you will use the same process: find a template, apply the rules, and validate. But give it time. Be comfortable, then move on.