Displaying Corporate News with the Content Search Webpart

What is the most important content of a Corporate Intranet? Of course it’s the menu of the factory canteen and the Corporate News. Although it would be worthwhile to have a close look on how to implement the menu, I will focus on the Corporate News in this blog post. If you create a corporate intranet you’ll probably use several site collections. In most cases the Corporate News is going to be displayed on the intranet’s home page and the news items are stored in a generic list or in an announcements list. What happens if the news list is located in another site collection but the site collections that hosts the intranet’s home page? In that case you are faced with the the requirement to display content from one Site Collection in another Site Collection.

The recommended way to get this done is to use the Content Search WebPart – and in this blog post I will show how to use the Content Search WebPart to display items from a list with Corporate News. So let’s first setup the demo environment:

First I create a new Content Type that should be used for the list with the Corporate News:

Displaying Corporate News with the Content Search Webpart

Next I add a few fields to the newly created Content Type:

Displaying Corporate News with the Content Search Webpart 2

Next I create a generic list where the corporate news items are saved to. That list is based on the Content Type I just created:

Displaying Corporate News with the Content Search Webpart 3

Next I change the Display Name of the title field to ‘News Title’ – looks more user-friendly, don’t you think so? 🙂

Now it’s time to add some demo content. I’m not that much creative today, so I used the Lorem Ipsum generator to do the job 🙂

4

Next step: the Content Type and the Demo Content need to be put into the SharePoint Search index. An incremental crawl should do the job.

After the Incremental Crawl has been finished I add an new Content Search webpart on a page and open the webpart properties:

5

Step 1 is to configure the query – so I click on Change query:

I want to create a query that targets the Corporate News list and includes all items that are based on the Content Type I just created.

6

As you can see in the preview on the right side of the dialogue: my two items from the Corporate News list are shown.

Since I don’t have any refiners in this example I just step over the next tab.

7

On the next tab I just have a look on the settings, but leave them unchanged.

8

I’m finished with the query for the moment. With the query I just created the webpart should be able to retrieve the news items.

Let’s go back to the webpart properties. Now I need to configure how the news items should be displayed.

I want the title of the news to be displayed as clickable Hyperlink and I want to have the News Teaser to be displayed on a second line. Because I created a Content Type for the Corporate News list the News Teaser becomes a managed property that can be used in the webpart properties.

9

Now I click on the OK Button – and the Corporate News look like this:

10

Time for another test: I add a third news …

11

…start an incremental crawl and have a look on the page with the Content Search webpart again:

12

The third news appears just after the incremental crawl has been finished. Maybe I should add some sorting now …

A

B

… much better now 🙂

To get the Sorting settings just click on ‘Switch to Advanced Mode’ on the ‘Basics’ tab.

1

This is a very simple approach to setup Corporate News in an intranet that uses multiple Site Collections and a Content Type Hub to publish the Corporate News Content Type to all other Site Collections. But this example shows the basic steps to configure a Content Search WebPart. I a real world scenario would probably would like to provide filtered looks on the Corporate News – e.g. providing news that are tagged with a special Managed Metadata tag. To do this just add the Managed Metadata tag to the refiner tab.

Update: A reader of my blog asked me if it would be possible to add an image to every news and to display the image together with the news.

Let me show you how to do that.

I updated the news content type and added a Picture field like this:

2

After that I updated all three news items and assigned a picture. I just took the pictures from the Site Collection Images library.

Next I started an incremental crawl to get the updates to the SharePoint Search Index.

The only thing left to do is: change the webpart’s configuration like this:

3

I marked my changes with a red rectangle. First I selected another ‘layout’ (Picture on left, 3 lines on right). Because I changed the news content type and did an incremental crawl, the new field (News Teaser Pic) becomes a managed property too. I used this as the Picture URL. Because the new layout now has 3 lines I added the author of the news.

And this is how the Corporate News are displayed now:

4

If you want to know more about Display Templates for the Content Search (CSWP) I recommend these TechNet articles:

SharePoint 2013 Customize Display Template for Content By Search Web Part (CSWP) Part-1
SharePoint 2013 Customize Display Template for Content By Search Web Part (CSWP) Part-2

If you have any feedback or questions for Oliver please leave a comment below.

Essential Guide To Enterprise Search In SP2013

Oliver Wirkus About the Author: Oliver Wirkus is Senior Consultant at the IT consulting company 2toLead in Ontario (Canada). As a SharePoint expert and software architect he has long standing experience in conducting international projects. Customers from different industries like power suppliers, pharmaceutical and financial companies rely on his knowledge as a SharePoint expert. Oliver Wirkus has published several professional articles, is a renowned speaker at conferences and maintains the well known SharePoint blog (http://sharepointcommunity.de/blogs/owirkus).

 

Would you like to become a full community member and have access to more great content such as eBooks, webinars, presentations and how to videos? Then simply click here to join the community.

It only takes a minute! 🙂

Latest blogs

Share this on...

Rate this Post:

Share: