Creating an RSS Feed in an Umbraco Application

date_range  23 December 2014

Tutorial
Umbrage
ASP.Net
.Net Development

So as I said yesterday, whilst moving across my blog, I didn’t bother to implement the RSS feed. But it’s quite a cool little feature that’s really easy to implement and I thought I’d share how I did it.

First off you’ll want to grab the Nuget package I made to create ActionResult instances from SyndicationFeed items.

	Install-Package JamesDibble.ApplicationFramework.Web.Rss

Now we can add a controller to the website project in Visual Studio and make it look something like this:

So this is pretty simple; we have two controller actions, if you don’t want an Atom feed you can just delete the second one. We use the helper methods to create the ActionResult and use a method to extract the content items and transform them into SyndicationItems.

Now I wanted these feeds to be part of my blog URI namespace, partly because that’s where they were before and secondly because that’s kinda where they live. To accomplish this I needed to register the routes as part of the Umbraco application initialisation. Again this isn’t mandatory to get this to work; the URI would be /syndication/rssfeed.

comments powered by Disqus

chevron_left Archive