Optimizely CMS easy RSS feed integration library

Posted on Friday, January 24, 2025

As I've mentioned in my previous blog post, while I was developing the Optimizely version of my blog, I tried to look for a library that could accommodate my RSS feeds needs with the CMS. I've found one made by another fellow OMVP peer, but unfortunately it wasn't quite covering my own requirements and I thought why not developing it from scratch altogether. 

Some might thing it's overkill, but it doesn't matter, I had fun designing & building it. 😄

Introducing DavidHome.RssFeed

This NuGet package integrates seamlessly into your Optimizely project and uses Azure Blob Storage for hosting your feeds. Whether you're building a single feed or managing multiple content streams, this tool is ready to meet your needs, and even better, its extensible!

I know there is probably stuff that has been totally overlooked, but any contribution will be greatly welcomed. If you'd like to, simply contact me via LinkedIn and I'll give you the required access to my git repository. 

Getting Started

First, install the required NuGet packages:

dotnet add package DavidHome.RssFeed.Optimizely
dotnet add package DavidHome.RssFeed.Storage.AzureBlob

Then configure the plugin in your Startup.cs:

  1. Configure Azure Blob Storage (inside ConfigureServices)

    services.AddDavidHomeRssFeed(configuration)
        .AddOptimizelyFeedIntegration(configuration)
        .AddDefaultOptimizelyProcessors()
        .AddContentPageFeed<MyContainer, MyItem>()
        .AddAzureBlobStorage(_configuration.GetSection("ConnectionStrings").GetSection("EPiServerAzureBlobs"));
  2. Initialize Blob Storage (inside Configure)
    app.UseAzureBlobRssFeed();

Heads up:

  • Azure Blob Storage is mandatory for this plugin. That said, if you're feeling adventurous, you can fork the project and add your own storage implementation or create your own NuGet package to extend the functionality.
  • You need to update "Microsoft.Extensions.Azure" to the latest version, or the further you can, so that support to use the direct IConfiguration section having the connection string information works as demonstrated there. 

Fine-Tuning Your Feeds

The plugin follows a configuration-less design, meaning you're good to go with just the defaults. But for those who want to tweak things, you can use appsettings.json to configure your feeds:

{
  "DavidHome": {
    "RssFeed": {
      "ContentMaxLength": 25000000,
      "MyCustomContainerPageTypeName": {
        "ContentMaxLength": 15000000,
        "ContentAreaPropertyName": "MainContentArea",
        "FeedTitlePropertyName": "HeadTitle"
      }
    }
  }
}

Key Optimizely-Specific Options

For Optimizely specific options, the following are available: 

  • FeedRelativeUrl: Allows customization of the relative URL of your feed(s) based on the location of your container page(s) in your CMS tree.
  • ContentAreaPropertyName: When provided, it will automatically extract the content of the content area as HTML and use it as the description field in your syndication item. 
  • FeedTitlePropertyName: This optional property is useful if you want to change the title of the link meta tag in your DOM head tag that can be generated when calling @Html.SyndicationLink() in your layout page.

You can personalize every feed, and yes, you can have multiple feeds targeting different sections of your CMS tree!

Setting Up Your Content Types

To integrate with Optimizely’s data structure, you'll need to apply these marker interfaces to your content types:

  • IRssFeedContainer<TFeedItem> for container types.
  • IRssFeedItem<TFeedContainer> for feed items.

Pro Tip: Add the IgnoreAttribute to unsupported properties. 

Azure Blob Storage

Azure Blob Storage powers the backend for your RSS feeds. It stores generated feeds over there so that when it's being requested, it doesn't go back to the database and try to build it again on the fly. This allows a fast and seamless delivery of the file and avoids to use your precious CPU/database computing resources. A scheduled job is automatically running in the background to generate and store the file representing the syndication feed of your content. It's scheduled by default to run each hours, but can be easily customized under the Optimizely CMS administrative interface. 

Room for Innovation

The library is built with extensibility in mind. While Azure Blob Storage is the default (and required for now), you're welcome to dive into the source code and add your own flair. Whether that's another storage provider or custom processors, the door is wide open for contributions.

Ready to get started? Check out the source code here and give it a try.