SP2013: Display multiple lines in the Pages (search) webpart

In SharePoint 2013, rolling up content has changed a lot. The Content Query Web Part is gone, which in my opinion is a GREAT thing. There are some new webparts to replace it, which are based on search.

One of those webparts is the Pages webpart. You can use that to show an overview of pages. By customizing the settings, you can adjust from which site the pages are shown, what kind of pages are shown, etcetera. This makes it very easy to create a news overview!

But… select one of the ootb display templates and you’ll notice that “3 lines” is exactly that: 3 individual lines. I like the summary of a news article to be as big as I require it to be, not always one single line. This article describes how to get to this result:

pages webpart multiline

Here’s the steps you need to take:

  1. Open up the site in SharePoint Designer and navigate to:
    _catalogs > masterpage > Display Templates > Content Web Parts
  2. Copy the default Item_Picture3Lines.html, or another template you like better.
  3. Give the file an appropriate name and edit it.
  4. Adjust the title of the template between the <template> tags
  5. Now find the DIV with Id “_#= line2Id =#_”
  6. It has two CSS classes attached to it. These classes wrap your text and displays ellipsis at the end of it. To just display the text in it’s full length; simply remove those classes.
  7. Save your custom template
  8. Edit the webpart and select your custom template
  9. Done!

And should you have other lay-out needs, you can of course add your own CSS classes and reference those. This way you’re pretty flexible in formatting the outcome, without the need of writing that annoying XSLT code we had to do with the CQWP.

Leave a Reply

Your email address will not be published. Required fields are marked *