Question

I am currently working on SharePoint Search customization and I am facing a problem while displaying the item display template for my custom result type.

In my scenario, I have just created a Custom result type named "Test". Added "Test.html" as display template for my custom result type and "Test_HoverPanel.html" for Hover panel in Site Settings-> Master Pages-> Display Templates -> Search folder.
I want to display this "Test.html" display template when the result is a Word Document and matching type of content should be "ContentType" starts with particular keyword. Please suggest to me how could I achieve this? If I am doing something wrong then let me know.

Was it helpful?

Solution

I would start with some simple troubleshooting.

  1. After uploading and updating your Display Template, did SharePoint create the Test.js sister file? This is the actual file that will be used as the display template.
  2. When you create the Result Type rule did you choose the right conditions? I would try Results="Documents" and Content=Microsoft Word and add "ContentType starts with any of Test" (or whatever your keyword is).
  3. Did you assign the right Display template? Select your Test display template and ensure that the DT Url is pointing at your Test.js file.
  4. Finally, did you publish your display template? This is a publishing library, so you need to publish the items for users to see them.

Failing all this, start over with a simple template and build up to your final product incrementally. Be methodical and you will find your error. http://www.ableblue.com/blog/archive/2013/06/05/introduction-to-sharepoint-2013-display-templates/

OTHER TIPS

also make sure you set the properties for your template file (html) right, target control type should SearchResults, otherwhise it won't show up in the dropdown of the result type

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top