1

I've done this in Sp2010 but I'm now trying to do this in SP2013 on premise and I'm stuck.

Effectively i want to edit the search results repeater part but i don't see this in the Control_SearchResults.html display template, all i see is as follows:

<!--#_ 
ctx.ListDataJSONGroupsKey = "ResultTables"; 
_#-->
_#= ctx.RenderGroups(ctx) =#_

Is the repeating part of the search results page help somewhere else? i need to adjust the URL paramter for certain search results but looking at the above file it would seem i cant.

1 Answer 1

2

What you are seeing there is the placeholder for the item results within a Control Template, so by editing this HTML file you can affect the wrapper around the results (for example to style or apply paging or other static elements to the page) but not the results.

In either of the search results web parts (Search or Content Search) you have the option of applying two templates, a Control and Item. The Item is the one you are looking for if you want to style the results.

What you need to do is locate the item template being used, copy it in the location it sits (Masterpage Gallery under Display Templates) and paste it back, rename it and open the file in something like Notepad++. Change the title of the HTML document (that's what you will see in the web part drop downs later) and then change the DIV contents to show what you need for each result and save back the file to the folder to allow SharePoint to generate the .JS file automatically for you.

After that you can open the Web Part settings and choose your new template. Once you publish the page you can keep editing the HTML (map the location as a drive works well) and see the changes you make to the HTML as you save (allowing a few seconds for the .JS to be auto generated each time).

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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