Import multilingual News from external RSS feed in Sitefinity

By August 7, 2014.NET, C#, News, Sitefinity, Web
Content to Include - RSS

You might have used Alternative Publishing in the past, which can be a very handy feature. By using it you can publish any type of content as feed and/or import into any module. At times, there may be a situation where you would need to set custom field values in the News module. This cannot be done through the UI, but we can make this work with some code. Let’s suppose we have the following custom fields in our News module that we need to set with the values in feed:

  • Thumbnail
  • IsExternalSource
  • Tags (this is a built-in field but it’s not imported out of the box)

Take these English and Arabic feeds as an example from an external source.

Keep in mind that it’s one of the challenges to create translations of news items from two different feed URLs. Each <item> tag in the feed represents information of news items differentiating with a <guid> tag. So, items in English and Arabic with the same GUID represent the same news with a different translation.

Now we need to override RSSInboundPipe which is used to import items as a Sitefinity content type. Here, we will add our custom logic to extract values from non-standard tags in the feed (like thumbnailUrl), and add those to WrapperObject.


Notice a method named GenerateItemHash above? This will ensure the items in different feeds are actually the same (with different translations) if the GUID matches.

Method SetOrAddProperty will not add value yet. We will have to override the ContentOutboundPipe class as well to make sure the values are set to extra fields.


Note: You can find the Helper class here.

Register custom inbound and outbound pipes in Global.asax.cs.

Now, all we need to do is to set up inbound using Sitefinity’s backend. So, log on to dashboard and go to Administration > Alternative Publishing.

  1. Click ‘Create a feed’.
  2. Enter title ‘News Inbound Feed’.
  3. Remove default item from ‘Content to include’ section and click ‘Add another content type’.
  4. Enter the following settings for English and Arabic (or any other language). Editing mapping is not required.
    Content to Include - RSS

    Content to Include – RSS

  5. Remove the default item from ‘Publish as…’ section and click ‘Add more…’.
  6. Enter the following settings for English and Arabic (or any other language). Editing mapping is not required.
    Content to Include - News

    Content to Include – News

  7. Your feed settings should look like this.


Note: Please change feed URL to actual one.

And you’re done!

The following two tabs change content below.