This is a classic article about how to create a RSS Feed using our beloved CMS and this topic has been asked about 5 million times now on Google Groups Wiki and everywhere else… This question or furthermore one of these variations below will now be answered:
To create an RSS Feed within RedDot CMS you just need ONE template.
There is no need to create a separate XML variant or anything like this.
Just change the elements within the template to match your news elements and you are ready to go.
Don’t change the date element, this is a sensitive one which needs some ASP script to read a proper readable date for the RSS Feed.
The template below makes use of some nice Render Tags which you should check out. Especially the Render Tag described in the SEO article come in handy when you link news from different sections within the project connected to your RSS feed list using keywords.
So what did we do here? Let’s have a closer look at the single bits and pieces within the template.
The first part contains two ASP functions “GetMonthName” and “GetDayName” to render the date returned by the RedDot element stf_pageDate properly in a RSS format. So DON’T TOUCH THE stf_pageDate element.
Then we have this part in the links:
<%stf_siteURL%><%!! Escape:HtmlEncode(Context:Indexes.GetIndexByPageId(Guid:<%info_PageGuid%>).Page.GetUrl()) !!%>
The siteUrl element should be the URL of your site (for example: www.reddotcmsblog.com if this would be your site..)
The second Render Tag bit returns the MainLink of the page to the linked site no matter what publication package is assigned to the RSS Feed.
All the other bits and pieces should be self-explaining.
To integrate this template in your project:
Feel free to re-use the code linked below. Don’t use the code above because it is just an example and it gets scrambled by the Syntax Highlighter. However both versions come with no warranty. When re-used by you we expect you to attribute this work and use it according to the CC license BY-SA 3.0. Thanks to the famous Plugin Developer and super coder Kim Dezen who helped me out with the code bits but hates writing other things than pretty code so I have to do it.
It also needs to be said that this example is a very basic one and you can enhance any fields you need. Feel free to send us your examples if you have improved this marvelous Open Text solution!
We can’t get around to outline it and remind you. This site still runs for free. And this won’t change from todays point of view unless we manage to convince OpenText to make a bigger donation because we solve at least as many support requests per day as they do.
So grab your code, enjoy the work we share here with you and if you find it useful then after downloading the template feel free to donate (it should be enough for a beer..).
Dude, your code has been seriously beat up by auto filters…
Hey Rob, that’s true.. The Syntax Highlighter doesn’t work properly because it doesn’t know the RedDot template language.
Therefore I removed it and put a screenshot in place.
Sorry about that, just use the download to get the template.
Great approach. I just integrated it into my current project and modified it a bit to fit my needs. Due to my passion to php i’ve deleted the preexecute-functions in the head and replace the date output to: <?php echo date("r", strtotime("”)); ?>.
Don’t be shy. Feel free to send me your PHP version. I would be happy to add it to the article
Hi Markus, great template, very useful.
Wonder if you could elaborate: do you create an Unlinked Page for the feed? I tried this but the link to the feed in the source code went to an error…didn’t seem to get published.
Hey Neil, all I did was create an unlinked (not connected to navigation manager) page and assigned a publication package which publishes the file into the root folder. Let me know if this helps, otherwise I can certainly provide some more details.
Hi Markus. Got it working to a point; can’t get the last part of the URL (e.g. article-name.htm to publish within the feed but can work on that). I’ve created a couple of dynamic links for a news and events feed from an unpublished ’start’ page – does this sound like a suitable way to do it?
Hey Neil, that sounds like the right way to do it. Why can’t you get the filename of the page?
You could use an info element or (better) the Render Tag within the template.
Hi Markus,
I’ve implemented RSS feeds similar to yours into our website, but I’m confronted with the following problem: my RSS pages are published to 2 different websites (internetsite and intranetsite) . I don’t have any idea how to get the to change it’s value according to the site where the RSS page is published. For the moment the RSS feeds are only functional on the internetsite. Thx in advance for any advice to help me solve this problem.
The value that causes me headache is of course the value of the variable stf_siteURL.
Hey Bart! In that case I would just create another page based on the RSS template, append a different publishing target and change the standard field value for this page.
Does that work at for you?
Hi Markus,
Your solution is clearly the correct one.
The RSS feed however is present in a page using an anchor element so people can subscribe to it (that’s nice).
If I create a second RSS feed, I have to create a second anchor in that so called subscriber page, meaning the 2 anchors will be visible in this page,
although only 1 anchor will work depending on the website it is published to.
This will make certain people go crazy, and since there are enough fools on this planet, I’ve decided to let it rest in peace.
Having to deal with two different sites using one data source but two different types of URLs / folder structures is always a fun part..
You can put the link to the RSS feed into a variable and ON the published site run a script over it to find out which URL it is and then use a if/else to show either the RSS link a or the RSS link b with the correct prefixing.
Generally I think serving two different websites based on ONE RedDot project causes trouble too often.