Implementing RSS: a Simple RSS Bare-Bones RSS Module

Implementing RSS: a Simple RSS Bare-Bones RSS Module

July 17, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.



There has been interest from you about RSS. That is why we decided that a new sample module should be made to demonstrate just that. You can download the module's source code from here.




Having said that this module is going to be bare-bones, it will not feature anything fancy. Data layer is practically non-existent, there is just one public control and a single view. However, even for this small functionality, I use the new back-end architecture. I believe this is a good approach, because many of you might want to start with this code to save some time.

I have always thought that diagrams help understand matter best. Here is one that displays the relation of the interfaces that you must implement in order to have RSS functionality in your module:

 Relation of RSS-related interfaces in Sitefinity

RSS interfaces explained

  • IRssProviderModule
    This one should be implemented in your module class. On startup, Sitefinity checks all modules, and if they implement this interface, they are registered with the RSS service. This means that, unlike some other features, you don't need to add new settings to web.config in order to have RSS enabled.

    The purpose of this interface is to
    • Identify your module that it implements RSS
    • Register your RSS feeds. Every feed has:
      IRssProvider, IRssViewControl and IRssSettingsControl

  • IRssProvider
    This is what Sitefinity's RSS service calls when the RSS url is requested. In other words, this dynamically creates your RSS file.

    So, how do we generate the RSS feed? First, some "theory". In Sitefinity, we separate the feed into items. Every item is abstracted by a class (RssItem). By "abstraction", I mean that you don't need to concern yourself with xml nodes, all you have to do is fill its properties.

    Here is a list of RssItem's most-often used properties:
    • public string Author { get; set; }
      Author of the RssItem
    • public RssGuid Guid { get; set; }
      Uniquely identifies the item. To construct a RssGuid, you might want to pass your data item's unique identifier's string representation to the RssGuid constructor.
    • public string Comments { get; set; }
      URL of a page for comments relating to the item
    • public Uri Link { get; set; }
      URL of the item.
    • public string Title { get; set; }
      Title of the item
    • public DateTime PubDate { get; set; }
      Indicates when the item was published
    • public string Description { get; set; }
      This is the actual content of the RSS item, its body.

    A question might arise: do I have access to the RSS XML that gets generated beyond the RssItem abstraction? The answer is: no. Sitefinity generates a standards-compliant .rss feed, and if you have custom requirements, you will have to implement RSS from scratch.

    If you had custom settings for your RSS feed (e.g. rules on what to enter the feed and what not; what gets generated depending on the user's role; summary settings, etc.), you would have received them in Initialize (which is called by Sitefinity before GetRssItems, so that you can properly generate your RSS).
  • IRssSettingsControl
    As mentioned before, you might want go have custom settings for your RSS feeds This class' purpose is to provide an UI for editing those settings. Therefore, the interface's members are:
    • public void InitSettings(IDictionary<string, string> rssSettings)
      We are given the last-saved custom settings. This is to give you the opportunity go set proper initial values to your text boxes and the like.
    • public IDictionary<string, string> SaveSettings()
      We are not required to persist the settings ourselves. All we have to do is return a dictionary of (setting_name, setting_value).

    An important thing to know is that Sitefinity provides UI for saving the settings. Both InitiSettings and SaveSettings will be called by Sitefinity, so you don't have to provide interface for that, as well.
  • IRssViewControl
    This is the easiest control: it provides read-only UI that summarizes any custom settings your feed might have. Its only method is InitializeSettings, which works the same way as IRssSettingsControl's

Source code

 If you haven't downloaded the source code yet, you can do it now. I won't explain it, as it is very well commented and strictly follows the explanations in this post.


While everything that I said in this post is explained in the documentation, it never provided a whole working example you can experiment with. I hope this post fills that gap.




The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
The New Mobile Development Landscape
Download Whitepaper
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar