https://github.com/abjerner/skybrud.umbraco.rssutils
A small library for easily creating RSS feeds in Umbraco.
https://github.com/abjerner/skybrud.umbraco.rssutils
csharp dotnet limbo package rss skybrud umbraco umbraco-package umbraco-packages umbraco-v8
Last synced: 7 months ago
JSON representation
A small library for easily creating RSS feeds in Umbraco.
- Host: GitHub
- URL: https://github.com/abjerner/skybrud.umbraco.rssutils
- Owner: abjerner
- License: mit
- Created: 2014-05-08T11:00:31.000Z (almost 12 years ago)
- Default Branch: v2/main
- Last Pushed: 2023-07-13T17:17:35.000Z (over 2 years ago)
- Last Synced: 2025-08-01T05:19:55.114Z (8 months ago)
- Topics: csharp, dotnet, limbo, package, rss, skybrud, umbraco, umbraco-package, umbraco-packages, umbraco-v8
- Language: C#
- Homepage:
- Size: 307 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Skybrud.Umbraco.RssUtils
========================
**Skybrud.Umbraco.RssUtils** is a .NET package that easily lets you create RSS feeds on the fly without having to worry about generating the proper XML - the package takes care of that for you.
Since the package is something that I have made for use in Umbraco projects, there is some Umbraco specific code to more easily create new RSS feeds based on `IPublishedContent`, but the package also plays well without Umbraco, so you can use it with other systems (or just native ASP.NET projects) as well.
## Download
Skybrud.Umbraco.RssUtils can be downloaded from NuGet:
http://www.nuget.org/packages/Skybrud.Umbraco.RssUtils/
## Example
The package primarily targets Umbraco, so here is a quick example on how the package can be used in a MVC view:
```C#
@using System.Xml.Linq
@using Skybrud.Umbraco.RssUtils
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
// Obviously the news articles shouldn't be hardcoded
var articles = new[] {
new {
Id = 1,
Name = "This is the first news article",
Url = "http://example.bjerner.dk/news/this-is-the-first-news-article/",
PublishDate = new DateTime(2014, 8, 31, 0, 58, 55),
Teaser = "This is the teaser text of the first news article"
},
new {
Id = 2,
Name = "This is the second news article",
Url = "http://example.bjerner.dk/news/this-is-the-second-news-article/",
PublishDate = new DateTime(2014, 8, 31, 1, 02, 34),
Teaser = (string) null
}
};
// Initialize a new feed and add the blog posts
RssFeed feed = new RssFeed {
Title = "News from Example",
Link = Model.Content.UrlWithDomain() + "rss",
Description = "You can now get news from Example as an RSS feed",
Language = "en-US"
};
foreach (var article in articles.Take(30)) {
feed.Add(new RssItem {
Title = article.Name,
Link = article.Url,
PubDate = article.PublishDate,
Description = article.Teaser,
Content = article.Teaser,
Guid = article.Url
});
}
// Write the RSS feed to the response stream
feed.Write(SaveOptions.None);
}
```
The above example would generate an output like this:
```xml
News from Example
http://localhost:54722/rss
Sat, 30 Aug 2014 22:58:55 GMT
You can now get news from Example as an RSS feed
en-US
This is the second news article
http://example.bjerner.dk/news/this-is-the-second-news-article/
Sat, 30 Aug 2014 23:02:34 GMT
http://example.bjerner.dk/news/this-is-the-second-news-article/
This is the first news article
http://example.bjerner.dk/news/this-is-the-first-news-article/
Sat, 30 Aug 2014 22:58:55 GMT
http://example.bjerner.dk/news/this-is-the-first-news-article/
```
## Changelog
### Skybrud.Umbraco.RssUtils 1.0.3
_31st of August, 2014_
__Download__
- [Get on NuGet](https://www.nuget.org/packages/Skybrud.Umbraco.RssUtils/1.0.3)
__Changelog__
- Changed namespace from `Skybrud.Umbraco.Rss` to `Skybrud.Umbraco.RssUtils` to follow package name ([See commit](/abjerner/Skybrud.Umbraco.RssUtils/commit/2f9fed5f07e51235d19c6d1b1755ec94f74c09e9))
- Introduced the description property for RSS items ([See commit](/abjerner/Skybrud.Umbraco.RssUtils/commit/cf881f00c5cc058a6e31e2f25a2bf599d9204df4))
- Added some extra format options when writing the feed ([See commit](/abjerner/Skybrud.Umbraco.RssUtils/commit/5a5cd2438ff1092a131ee6b6e76bd74ba232050a))
- Other adjustments throughout the package