RSS Feed with Razor in UmbracoRazor Macro to generate RSS feed for a document type.
Posted on Saturday, August 23, 2014
The aim of this snippet is to render a XML RSS feed within Umbraco running in MVC mode.
The idea I have used is have a RSS feed for document type of Press Release.
Create a document type of 'PressRelease' with properties:
(create and publish some content!)
Create a partial view macro called 'Razor', create Macro at same time.
Notes: Line 24 :
'<link> is a recognised by razor, therefore we need to use Html.Raw to enable this link of code to work.
Create a Template called RSS. Within this template:
Layout = null;
Then you can simple, by using the alternate template , call the feed by eg. http://yoursite.com/rss
This will render the XML RSS feed to be consumed by rss readers.
Parameters. Use macro parameters to enhance the RSS to choose document type, numbers returned etc.