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:
Here’s the steps you need to take:
- Open up the site in SharePoint Designer and navigate to:
_catalogs > masterpage > Display Templates > Content Web Parts
- Copy the default Item_Picture3Lines.html, or another template you like better.
- Give the file an appropriate name and edit it.
- Adjust the title of the template between the <template> tags
- Now find the DIV with Id “_#= line2Id =#_”
- 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.
- Save your custom template
- Edit the webpart and select your custom template
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.