Created
March 13, 2014 23:10
-
-
Save abjerner/9539103 to your computer and use it in GitHub Desktop.
Very small amount of code required to create a RSS feed in Umbraco.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage | |
@using Bjerner.Website.Web | |
@{ | |
Layout = null; | |
RssFeed feed = new RssFeed { | |
Title = "Bjerner.dk Blog", | |
Link = "http://blog.bjerner.dk/", | |
PubDate = DateTime.Now, | |
}; | |
foreach (IPublishedContent child in Model.Content.Children.OrderByDescending(x => x.CreateDate).Take(20)) { | |
feed.Add(new RssItem { | |
Title = child.Name, | |
Guid = child.Id.ToString(), | |
PubDate = child.CreateDate, | |
Link = child.UrlWithDomain() | |
}); | |
} | |
feed.Write(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure. You can find it here: https://gist.github.com/abjerner/9543768