0

Create your own RSS feed

ColdFusion
I decided I wanted to write my own RSS feed for this site.  Mainly for the practice, but also because I wanted to have a little "Live Bookmark" icon in FireFox. (This little icon in the bottom right of your browser rss icon )

The first challenge was creating a well formatted xml document that would be recognizable by some RSS version.   I chose to emulate some of the RSS 2.0 feeds that I have seen. 

Things to note:
  • Include RSS and CHANNEL tags at the beginning/end
    •  <rss version="2.0">
    • <channel>
  • Before you begin to populate any items, be sure to include a <title> tag.  From what I have read, this is necessary for Firefox's live bookmarking.
  • THIS IS IMPORTANT: For the little Live Bookmark icon to show up in Firefox, you need to include a <link> tag within the <head></head> tags of your page.
    • <link rel="alternate" type="application/rss+xml" title="Aaron J Lynch RSS" href="/dev/rss/news.xml">

I used the ColdFusion function <CFXML> to generate the xml doc...sample code seen below.
<cfxml variable="variableName">
<rss version="2.0">
<channel>
<title>Feed Title</title>
<link>http://www.yoururl.com/</link>
<description>RSS FEED FOR your url</description>

<cfoutput query="qQueryName">
<item>
        <title>#qQueryName.NewsTitle#</title>
        <link>
http://www.yourrurl.com/ #directlinktonewsitem.cfm#</link>
        <pubDate>#dateformat(qarticleside.dtdateadded,"mm-dd-yyyy")#</pubDate>
</item>
</cfoutput>

</channel>
</rss>
</cfxml>


Here is a sample of the output xml:

<rss version="2.0">
    <channel>
                <title>Aaron J Lynch RSS Feed</title>
                <link>http://aaronjlynch.com/</link>
                <description>RSS FEED FOR AJL.COM</description>
        <item>
                <title>Agape Clinic Progress</title>
                <link>
                http://www.AaronJLynch.com/index.cfm?i=newsitem&e=26
                </link>
                <pubDate>11-07-2005</pubDate>
        </item>
    </channel>
</rss>

Let me know what you think.
tags:
ColdFusion

Search

Fuelly