RSS feeds using CityDesk
Published 2003-08-20. Last updated 2004-11-08.
Many people create RSS feeds for their sites in order to allow others to use so called news aggregators to keep track of when the site changes. If you’re lucky enough to use the content manager CityDesk, the process of creating a feed is really simple.
Here is a step-by-step guide for how to make a RSS version 2.0 compatible feed using CityDesk.
Set up a RSS feed template
First, we need to create a template for RSS feeds. We will later create an article that uses this template. This template can also be used for other feeds if you want more than one.
Create a new template and name it RSS Feed. Set its extension to .xml and copy the text from this table into the template in HTML View. It is important that you do not change to Normal View, since it will destroy what you just pasted.
<?xml version="1.0" encoding="utf-8"?>
{$ setDateTimeFormat "*" "ddd, dd MMM yyyy" "HH:mm:ss +0100" $}
<rss version="2.0">
<channel>
<title>{$.headline$}</title>
<link>{$.extra1$}</link>
<description>{$.teaser$}</description>
<copyright>{$.extra2$}</copyright>
<generator>Fog Creek CityDesk 2.0</generator>
<lastBuildDate>{$publishDate$} {$publishTime$}</lastBuildDate>
<managingEditor>{$.author$}</managingEditor>
<webMaster>{$.sidebar$}</webMaster>
<language>{$.about$}</language>
{$.body$}
</channel>
</rss>
Please note, that you may need to update the time zone information to match yours.
Close the template and edit the properties of the template to look like this.
Headline: Site Name
Author: Managing Editor E-mail
Teaser: Site Description
Sidebar: Webmaster E-mail
About the Author: Language Code (e.g. en-us)
Extra 1: Site URL (must end with /)
Extra 2: Copyright
The RSS feed article
Now, we create the actual feed. Add a new article in the site root named rss. Set its template property to RSS Feed. Set the properties and extras of the article. All information must be set, and it should apply to the whole site.
Copy the content of the table below into the article body in HTML View.
{$foreach 10 x in (folder "Articles") sortDescendBy .filedDate$}
<item>
<title>{$x.headline$}</title>
<author>{$x.author$}</author>
<description><![CDATA[{$x.teaser$}]]></description>
<link>{$.extra1$}{$x.absLink$}</link>
<guid>{$.extra1$}{$x.absLink$}</guid>
<pubDate>{$x.filedDate$} {$x.filedTime$}</pubDate>
</item>
{$next$}
Don’t forget to adjust the foreach loop to suit your site.
Finishing up
Tell the world about your feed
Normally, you use a small icon (looks like this
) to show that the site has a RSS feed. You should put it on the front page of your site, and make it a link to the feed you just created. For icons in other sizes and colors, please see Feed Icons.
You can also use a link tag to tell news aggregators that only knows about you site URL, where to find the RSS feed. Just add the following tag inside the <head> division of the main page.
<link rel="alternate" type="application/rss+xml"
title="RSS" href="http://www.example.com/rss.xml" />
The href attribute should of course contain the absolute URL to your feed.
Click publish
There you go! You’ve just equipped your site with an RSS feed. If you wish, you can make sure that your feed is valid using the online feed validator.
For more in-depth information on how to customize the feed, please consult RSS specification.