Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add RSS Feed

Ability to have an RSS Feed for your blog
  • Loading branch information...
commit 4baa3d0dd85ae51f71de5b8b9c57d09364bbd129 1 parent 63dd91d
@matthewroach authored
View
21 a/templates/feeds/all.inc
@@ -0,0 +1,21 @@
+<cfcontent type="text/xml" reset="true" /><?xml version="1.0" ?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+<atom:link href=" #### FEED URL #### " rel="self" type="application/rss+xml" />
+
+<channel>
+
+<title> FEED TITLE </title>
+<description> DESCRIPTION </description>
+<link> FULL URL TO YOUR SITE </link>
+
+ <cfloop collection="#page.content#" item="item"><cfoutput>
+ <item>
+ <title>#page.content[item].title#</title>
+ <description>#XMLFormat( page.content[item].body )#</description>
+ <link>http:// URL HERE /?/#_settings.url#/#page.content[item].url#</link>
+ </item>
+ </cfoutput></cfloop>
+
+</channel>
+
+</rss>
View
12 api/private/pages.cfc
@@ -41,6 +41,18 @@ component {
}
+ function feed( ) {
+
+ items = getHome( 99999 );
+
+ page = {
+ template : application.settings.templates.feed,
+ content : items
+ };
+
+ return page;
+
+ }
function getFile( page ) {
View
5 index.cfm
@@ -11,6 +11,7 @@
if ( requestString != '' ) {
firstQString = requestData[1];
+
if ( arrayLen( requestData ) == 2 ) {
requestAction = requestData[2];
}
@@ -23,6 +24,10 @@
page = _pages.all();
+ } else if ( _settings.url & '.xml' == firstQString ) {
+
+ page = _pages.feed();
+
}
else {
View
1  settings.json
@@ -13,6 +13,7 @@
"footer" : "/a/templates/global/footer.inc",
"view" : "/a/templates/pages/view.inc",
"archive": "/a/templates/pages/archive.inc",
+ "feed" : "/a/templates/feeds/all.inc",
"_404" : "/a/templates/error/404.inc"
}
Please sign in to comment.
Something went wrong with that request. Please try again.