SharePoint 2013 introduces a new way of rolling up content with the introduction of the Content Search Web Part (CSWP). There are many other blog posts on the ins and outs of how to set this up – check out these great resources:

Laura Rogers – SharePoint 2013 Web Part: Content Search

Benjamin Niaulin – SharePoint 2013 Content Search Web Part: Get it all in one place and style it

This blog post focuses on how we are using it on www.ShareThePoint.com.

Each SharePoint conference that we run is possible thanks to our wonderful sponsors. Many of these sponsors are companies we deal with on an ongoing basis and are part of our Extend Directory. Rather than duplicating information, we want to ensure we have one source of the truth, while being able to display that information in different ways and on different parts of our site.

 

Enter once and reuse the information

To display the sponsors for each event, we added a managed metadata column to our Directory listing so that we could record which companies sponsored which events (and at what level – e.g. Gold, Silver or Bronze). By using a site column on this list, we were then able to add the CSWP to the individual conference sites and display only the sponsors for that particular event.

CSWP-Sponsors

Once that information was stored, we could then add the web part to a page. Out-of-the-box, SharePoint 2013 provides several display templates for displaying your information.

Different Control and Item Options

CSWP-Display-Templates

You can easily make changes to the information that is displayed by ticking the Change the mapping of managed properties for the fields in the Item Display Template option. This allows you to pick what fields from your source data you wish to display. Below, we are specifically choosing to display the Sponsor Logo as the main picture. This is a site column that is part of the Directory listing.

CSWP-Property-Mappings

We decided to use one of the existing list styles, but tweak it so that the page was focused on the sponsor logo only, with the addition of a clear link to find out more about that sponsor. Given we already had that information stored in our Extend directory, we chose to link directly to that entry.

 

There are more and more resources becoming available out there on how to set up your own display templates, but in a nutshell:

  • They live in the _catalogs/masterpage/Display Templates folder and can be accessed via SharePoint Designer or the Master Page gallery in the browser.
  • The display templates are HTML based rather then XSL.
  • If there is an existing template that is similar to what you want, then take a copy of that as your starting point.
  • You can add any styles you might need to your CSS.

 

Finally, we added some additional styling to the CSWP so that the different sponsor logos would display horizontally across the page, thereby reducing the amount of scrolling needed to see all of the sponsors. To make it a seamless experience for those visiting the site, we added the hyperlinks to the Directory as dialog popups so that the user was not directed away from the conference site that they were currently viewing.

The Directory dialog for a sponsor

CSWP-Directory-Listing

 

The final result: Sponsors page for the Sydney, Australia Conference

CSWP-Sponsors-Page

For those who might have previously battled with the Content Query Web Part (CQWP) in earlier versions of SharePoint, you may well be seeing some similarities. Yes the CQWP is still there in SharePoint 2013 and it appears to be very similar to what has been available before. The question then becomes – which do I use? Like just about anything to do with SharePoint, the answer is “it depends”. Check out the following comparison of the CSWP and CQWP to help you choose the right one for you.