Content-type: text/html Downes.ca ~ Stephen's Web ~ How to Create an RSS Feed With Notepad, a Web Server, and a Beer

Stephen Downes

Knowledge, Learning, Community

Jul 29, 2003

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.

The beer: get a beer from your fridge or buy one from your local store. Open the beer.

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)


 

 
 OLDaily
 http://www.downes.ca/news/OLDaily.htm
 OLDaily - By Stephen Downes 
 en-us

 
 Stephen's Web
 http://www.downes.ca/images/rss.gif
 http://www.downes.ca
 90
 36
 


 Attack Update
 http://www.downes.ca
 
 OK, here's where we stand. I have no email into
or out of downes.ca - this means that if you are sending me
email to stephen@downes.ca it will fail. It also means that
newsletter mailouts are failing (at least, I think they're
failing...). Additionally, all scheduled processes have
terminated, which means that Edu_RSS will be updated
manually. I have no tech support until at least tomorrow,
so it looks like we'll be limping along like this for a
bit. Again, please note, email sent to me at downes.ca is
not reaching me. By Stephen Downes, Stephen's Web, July
22, 2003
 
 
 
 Attack on Downes.ca
 http://www.downes.ca
 
 Downes.ca was off the air for a few days
following a denial of service attack. We are back for now
but things are still touch and go. I'll keep you posted. 
By Stephen Downes, July 21, 2003
 
 
 
 

(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. Take a sip of the beer. You've earned it.

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 . The information following this tag, and above the tag that says , 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, so take a couple of sips of beer.

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 tag. In the example above, I have included two items. You can see that the description for each starts at the tag and ends with the 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 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 and have a sip of your beer.

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: &
    - 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 "
    - For example: He shouted, "Fire!" becomes, He shouted, "Fire!"

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

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

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

    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. Have another sip of beer.

    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:

      <=img src="xml.gif" width=36 height=14 alt="RSS feed for this site" border=0>

      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

      Finish your beer. You're done. Don't forget to recycle the bottle.

      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.



Stephen Downes Stephen Downes, Casselman, Canada
stephen@downes.ca

Copyright 2024
Last Updated: Dec 22, 2024 12:53 p.m.

Canadian Flag Creative Commons License.

Force:yes