Usage example - External RSS feed

In addition to creating RSS feeds for Kentico content, you can also use external RSS feeds (i.e. feeds published on other websites) as a source of data and display the data on your website.

The following example demonstrates how to use the RSS data source and Basic repeater web parts to display content of an external feed on your website. The example uses the main blog post feed from Kentico DevNet: http://devnet.kentico.com/CMSPages/BlogRss.aspx

Add the RSS data source web part onto your site:

  1. Open the Pages application.
  2. Select the root of your website’s content tree.
  3. Click New () above the content tree and create a document of the Page (menu item) type.
  4. Type External RSS into the Page name field and choose Create a blank page.
  5. Click Save.
    • The system creates the page and selects it in the content tree.
  6. Switch to the Design tab.
  7. Add the RSS data source web part onto the page.
  8. Enter the following values into the Web part properties dialog:
    • Web part control ID: KenticoBlogsRSS (this ID will be used to connect the repeater that displays the data)
    • RSS feed URL: http://devnet.kentico.com/CMSPages/BlogRss.aspx (this is the URL of the external RSS feed)
  9. Leave the rest of the properties at their default values and click OK.

Add the second web part:

  1. On the Design tab, add the Basic repeater web part onto the page.
  2. Configure the web part’s properties as follows:
    • Data source name: KenticoBlogsRSS

    • Transformation name: click New and create a new transformation with the code below.

      
      
      
        <h2>
          <a href="<%# Eval("link")%>">
          <%# Eval("title") %>
          </a>
        </h2>
        <p>
          <strong>Published</strong>: <%# Eval("pubdate") %>
        </p>
        <p>
          <%# Eval("description") %>
        </p>
        <br/>
      
      
        

      The transformation code transforms the link, pubdate and description elements of each record provided by the feed. Content of the elements is retrieved using the Eval method, with the element name specified as the parameter.

  3. Leave the rest of the web part properties at their default values and click OK.

On the Design tab, you can see the web parts.

RSS data source and Basic repeater web parts on the Design tab

If you switch to the live site and view the new page, you can see the content of the RSS feed.

The output of the external feed on the live site