Wednesday, November 11, 2015

SharePoint 2013 / SharePoint Online Display Templates missing

Microsoft has introduced Display Templates in SharePoint 2013 which is very powerful.
I ran into an issue with it.

User: I could not find my search results. It is showing error on all my search terms

I looked into it. The error message was;

Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.

Template '~sitecollection/_catalogs/masterpage/Display Templates/Search/Control_SearchBox.js' not found or has syntax errors. (LoadTemplate: )

I got a point after seeing this error. I went to Site collection feature and checked whether the feature "Search Server Web Parts and Templates" is activated or not.

It is Activated !!!!!
Then I went to Site settings -> Web designer galleries -> Master pages. I am surprised to find the folder "Display Templates" is missing.

This issue will be resolved if you Deactivate and Activate the feature.

But I fixed it by other way. ;) I copied the folder "Display Templates" from other site collection and pasted it in reported site. Boom ! It worked !