SharePoint Config

Ari Bakker's thoughts on customising and configuring SharePoint

Changing the RSS feed for a SharePoint Blog

with one comment

This post shows how you can update the RSS feed for your SharePoint blog. This is useful if you want to take advantage of services such as feedburner that provide statistics on the number and type of subscribers a blog has.

The steps involved are:

  1. Subscribe to an external feed provider
  2. Replace the link in the tag of your posts page to point to the new feed address
  3. Remove the javascript from the posts page that dynamically updates the RSS feed link
  4. Add a link to the new feed on the posts page

Subscribe to an external feed provider

I won’t go through this here but it basically involves signing up to a site such as feedburner and pointing your feed to the address of your SharePoint blog feed (which will be something like /_layouts/listfeed.aspx?List={C5B17C5B-D3E6-4A90-BC7E-A9011B786550}). This will give you a new feed address you can use to access a feed of your blog posts. For example you can access my posts through the feedburner URL at http://feeds.feedburner.com/aribakker.

Replace the link in the tag of your posts page to point to the new feed address

  1. Open the default.aspx page of your blog in SharePoint designer
  2. In the PlaceHolderAdditionalPageHead content placeholder replace the <SharePoint:RssLink runat="server"/> tag with one similar to the following: <link rel="alternate" type="application/rss+xml" title="Posts" href=http://feeds.feedburner.com/aribakker>

This link tells the browser that the page contains an RSS feed.

Remove the javascript from the posts page that dynamically updates the RSS feed link

This is the most complicated step. The way SharePoint creates the RSS link in the navigation is that it renders an empty div tag with the id ‘BlogRSSNav’ as part of the navigation control. When the posts list web part renders it generates the URL for the RSS feed and dynamically writes this into the ‘BlogRSSNav’ div using javascript. As we are using a static address for our RSS feed we need to fill in the contents of the BlogRSSNav div with our RSS address and remove the javascript that updates this.

  1. In the default.aspx page find the Posts ListViewWebPart (located in the PlaceHolderMain content place holder).
  2. In the ListViewXml property of the Posts ListViewWebPart remove the following javascript block:
    <script>
    var divBlogRSSNav = document.getElementById("BlogRSSNav");
    var divBlogRSSMain = document.getElementById("BlogRSSMain");
    if (divBlogRSSNav != null && divBlogRSSMain != null)
    {
    divBlogRSSNav.innerHTML = divBlogRSSMain.innerHTML;
    divBlogRSSNav.className = "ms-blogrssnav";
    divBlogRSSMain.removeNode(true);
    }
    </script>

Add a link to the new feed on the posts page

  1. In the default.aspx page find the BlogRSSNav div element (located at the end of the PlaceHolderLeftNavBar content place holder)
  2. Add html similar to the following inside the element:
    <a href="http://feeds.feedburner.com/aribakker"><img src="/_layouts/images/rss.gif" alt="" align="absmiddle" border="0"> RSS Feed</a>

Now people who subscribe to your blog can be tracked. I’m currently using feedburner for my blog, which is a free service and provides statistics as shown below:

Feedburner Statistics

Note: This will customise the default.aspx page from the site definition. If at any time you want back to revert back to the original simply right click on the file in SharePoint designer and select ‘reset to site definition’.

Post to Twitter Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Written by Ari Bakker

May 31st, 2007 at 10:11 am

Posted in Blog Customisation

One Response to 'Changing the RSS feed for a SharePoint Blog'

Subscribe to comments with RSS or TrackBack to 'Changing the RSS feed for a SharePoint Blog'.

  1. Hi -

    Does anyone know if you can track subscribers using Moss rss feeds in Sharepoint reporting?

    Dave

    Dave

    15 Oct 08 at 12:48 am

Leave a Reply