5

I am working on a sharepoint server 2013 enterprise edition. and i have 2 site collections; http://servername/ & http://servername/depts . where the later site collection contain multiple sub sites. Now I want to use the Content search we part inside the http://servername site collection to show items from different sub sites inside the http://servername/dept site collection.

So i follow these steps:-

  • I went to my site collection http://servername/

  • Edit the home page, add a new Content search web part.

  • I define the following query to mainly show all the items that are associated with the related issue tracking content type and are under the http://servername/dept url:-

enter image description here

  • then i define the following to show the title, created & site tile fields for each item.

enter image description here

  • Finally the output i got inside the content search webpart is as follow:-

enter image description here

now i am still not sure how i can do the following 2 modifications:-

  1. add more fields beside the title, created & site title?

  2. how i can show the fields in a table based view, so each item will have its fields shown in a single row, rather than showing the item's fields under each other (as shown above) ?

so can anyone adivce how i can achieve my above 2 modifications ?

1

By using Display Templates you can change the way you want to display results of content serach web part.

You can find a variety of Display Templates at this link

To have table based view, please follow these steps.

  1. Copy Control_List_Table.html & Item_List_Item.html files from this link and paste into this path ~sitecollection/_catalogs/masterpage/Display Template/Content Web Part/
  2. Publish all the copied files to their major versions.
  3. Now Edit Content Search Web part. In Display Template section, select List Table Control for Control and List Table Item for Item dropdown.
  4. Now you will be able to see, multiple properties in Property Mapping section where you can map multiple Managed Property which will be displayed as columns in tabular view of search results.

Customize these display templates as per your need.

Here are some references on display templates:

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

Content Search Web Part: Custom Display Templates

SharePoint 2013 Design Manager display templates

  • thanks for the links will have a look at them,, never thought that i can download ready temples instead of having to build them from scratch – john Gu Sep 27 '16 at 16:44
  • 1
    I have used these display templates before and they are simply awesome. Great work has been done by author of those display templates. – Yayati Sep 27 '16 at 16:48
  • i also found this link github.com/SPCSR/DisplayTemplates/tree/master/… i tried the Control_List_Table.html & Item_List_Item.html .. seems they are great and provide sorting capabilities also – john Gu Sep 27 '16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.