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:
- Display Templates Support HTML & JavaScript instead of XSLT (which is often quite cumbersome to work with).
- Display Templates based configurations supports 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).
- 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).
- As the Display Templates are scoped to Site or Site Collection, they can be used for all kind of results, can be used with in Content Search Web Part, Refiners and so on.
I recommend you follow this MSDN Article on Display Templates to get an in depth understanding on the topic.
By now we have a fairly good Idea on “What are Display Templates?” and now it is time to see them in action.
Business Scenario:
- Additional User Profile Property should be added to User Profile Page which will hold the User’s LinkedIn Profile URL.
- There should be a provision to adjust the display position of this Property in Core Search Result Web Part.
Prerequisites:
- User Profile Service should be up and running.
- User Profile Synchronization should be configured.
- Search Service Application Instance should be configured appropriately.
- Search Center Site Collection should be configured appropriately.
In order to see Display Templates in Action, we need to perform following steps:
- Create User Profile Property.
- Start Full Crawl of Content Source for the User Profiles.
- Create, Map and Configure Managed Property.
- Start Full Crawl of Content Source for the User Profiles.
- Create Display Template.
- Create Result Type with Custom Display Template.
- Test Display Template.
Create User Profile Property,
Go To Central Admin >> Manage Service Applications

Click on User Profile Service Application,

Click on Manage User Properties,

Click on New Property,

Enter Name, Display Name, Type & Length for the User Property as needed.

Make sure Default Privacy Setting must be set to Everyone,

Make sure Indexed must be selected under Search Settings Section, else this property will be skipped by Search Crawler and it won’t be available to use later.

Once done with it click OK to add the User Property,
Once added you can find the new property under Custom Properties Section,

Go to Manage User Profiles,

Find the required User Profiles and Edit their Profiles by selecting Edit My Profile from ECB Menu,

On the User Profile Page, locate the LinkedIn Profile Property,
Enter the URL to LinkedIn Profile of the User and Save the User Profile Properties,


With this we are all done with the Creation of User Profile Property.
Start Full Crawl of Content Source for the User Profiles,
Now in order to generate the Crawled Property corresponding to the User Profile Property we need to run the Full Crawl on the People Content Source,
Go to Search Service Application,

Click on Content Sources,

Click on People Search and select Start Full Crawl from ECB,

Wait till the Crawl Status become Idle,
Create, Map and Configure Managed Property,
Go to Search Schema,

Click on Crawled Properties Link,

We should verify if the Crawl Property corresponding to our User Profile Property has been created successfully or not,
Find the Crawled Property by entering Search Term in Crawled Properties Textbox and click on the Image button with Green Arrow image.






























Sumit DeshmukhPosted Nov 23, 2017, 10:52 PM
Really helpful.. Thanks for Sharing Sir
Gowtham RajamanickamPosted May 9, 2016, 4:33 AM
Amazing article..