The WorkerThread Blog

we know stuff so you don't have to

Archive for December, 2010

SharePoint 2010 RSS Viewer Web Part Tip and Question

Posted by workerthread on December 10, 2010

Here’s a quick tip you may want to use if you are working with the RSS Viewer web part in SharePoint 2010 and want to open articles in an new window – also a quick question I would appreciate any comments on.

The RSS Viewer web part is a good way of adding interesting content to SharePoint site home pages.  There are lots of good quality RSS feeds out there – for example BBC News, various Microsoft Technical resources and many diverse trade publications (or even this blog).   It’s pretty easy to set up once you have chosen a useful feed.  Here’s an example which has been configured to use the TechNet News feed:

RSSFeed1

Clicking on an article heading will reveal some more detail:

RSSFeed2

Then if you then click on the “More…” link, you will open the source article in the current window.  Now, I’ve found this is not always ideal and you often want to open the article in a new window, without leaving your SharePoint site page.  To make this happen, it’s necessary to make a change to the “More…” hyperlink.  You do this by editing the web part and clicking on the XSL Editor button to open the text editor:

XSLEditor

This exposes the XSL styles which define how the RSS feed is displayed (if you’re looking for XSL syntax info by the way, take a look online for articles by Marc D. Anderson – he’s published some excellent stuff).

One particular line is of interest to us.  It’s in the section “RSSMainTemplate.description” and is the line defining the “href” tag to open the article when clicking on “More…”:

<a href=”{ddwrt:EnsureAllowedProtocol(string(atom2:link/@href))}”>More…</a>

To make the article open in a new window, you need to add a target=”_blank” attribute like so:

<a href=”{ddwrt:EnsureAllowedProtocol(string(atom2:link/@href))}” target=”_blank”>More…</a>

(by the way I prefer to copy the entire XSL into a better text editor to make my changes, then paste the whole lot back into the web part XSL Editor afterwards rather than working in the web part editor)

Once you’ve done that, apply your changes and you will find that your RSS feed articles will open in a new window when you click on the More… link.

And so to My Question –

In some circumstances I’ve noticed there can sometimes be problems with the RSS Viewer web part loading correctly – it seems to get stuck in “Loading” mode without ever completing.  I’ve checked around to see if anyone else is experiencing this with SharePoint 2010 but haven’t found any definitive information.  There’s a school of thought that this could occur when Alternate Access Mappings have been set up for the web application, although I’m not sure why this would be.  So if anyone can shed light on this please leave a comment!

Technorati Tags: ,,

Posted in Microsoft SharePoint | 4 Comments »