How to Create An RSS Feed

What's an RSS Feed?

Radio City Music HallAn RSS feed is a computer-readable index of your website. Instead of using HTML, which is designed for formatting on the screen, you use XML, which is designed to be easy for computer programs to read. It's a really simple way for a web site to syndicate its content, much like comic strip writers syndicate their strips so that they can be republished by lots of other publications.

Why Would You Make One?

When you create an RSS feed from your web site, an index of your latest pages will automatically be available to other computer programs and web sites. For example, UserLand's Radio UserLand product allows people to subscribe to a bunch of different RSS feeds and see everything that has changed on a bunch of sites at once.

How Do You Create One?

Since CityDesk's templates are so flexible, it's easy to create an RSS feed. Instead of creating an HTML file, you have to create an XML file.

Step 1: Create a new HTML file in the main folder. Rename it rss.xml.

Step 2: Paste this code into the HTML file. Edit the name, URL, description, and email addresses to match your site.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://p.moreover.com/xml_dtds/rss-0_91.dtd">
<rss version="0.91">

<channel>
<title>Your Web Site Name Here</title>
<link>http://www.yourURLhere.com</link>
<description>A Short Description of your Site</description>
<language>en-us</language>
<copyright>Copyright 2001 Your Name Here.</copyright>
<managingEditor>your@email.com</managingEditor>
<webMaster>webmaster@email.com</webMaster>

<image>
<title>Your Web Site Name Here</title>
<url>http://www.website.com/images/a-small-picture.gif</url>
<link>http://www.yourURLhere.com</link>
<width>32</width>
<height>31</height>
<description>A short description of your site, again</description>
</image>

{$ foreach 10 a in (all) sortDescendBy .filedDate $}

<item>
<title>{$ a.headline $}</title>
<link>http://www.yourURLhere.com/{$ a.link $}</link>
<description>
<![CDATA[
{$ a.teaser $}
]]>
</description>
</item>

{$ next $}

</channel>
</rss>


You may probably want to adjust the foreach loop -- the way this one is coded, it grabs the 10 latest articles and puts their teasers into the RSS feed. But you might want to select articles from a particular folder.

Step 3: That's it! You've got a feed! Test it out by publishing your site and running using the RSS Validator. If all is well you can submit it to the directory at Syndic8 to be included in a global directory of sites with RSS feeds.

For more details on the RSS format, read the spec.

CityDesk Home

Fog Creek Home

Email Us