SharePoint 2013: How To Create Custom Display Templates For SharePoint Search

What are Display Templates?

Display Template is a new technique introduced in SharePoint 2013 in order to modify the look and feel of the search results by making use of HTML & JavaScript instead of XSLT modifications as we did in the earlier versions.

With this new rendering technique or rather framework, SharePoint offers some of the most compelling advantages as mentioned below:

  1. Display Templates Support HTML & JavaScript instead of XSLT (which is often quite cumbersome to work with).
  2. Display Templates based configurations support a broader scope of execution than XSLT based configurations. (As Display Templates should be defined at Site or Site Collection Scope while XSLT based Templates could only be defined at the WebPart Scope).
  3. Display Template applies Per Item Basis and not Per Result Set Basis (Provides us with the Context of the Current Item which is under execution, so that we can make use of any Managed Metadata Property associated with the Search Result Item and render it as per needs)
  4. As the Display Templates are scoped to Site or Site Collection, they can be used for all kind of results, can be used within Content Search Web Part, Refiners and so on.

Recommend you to follow this MSDN Article on Display Templates to get an in-depth understanding of the topic.

By now we got a fairly good Idea on “What are Display Templates?” and now it is time to see them in action.

Business Scenario

  1. Additional User Profile Property should be added to User Profile Page which will hold the User’s LinkedIn Profile URL.
  2. There should be a provision to adjust the display position of this Property in Core Search Result Web Part.

Prerequisites