SharePoint

How to remove the hover panel within the SharePoint 2013 Search results

For one of our customers I had to create a table of contents of all the site collections within one web application. Thanks to my good SharePoint buddy Benjamin Niaulin, I knew how to do this. I used the Search Results web part and added the following query:

path:”https://contoso.sharepoint.com” contentclass:”STS_Site”  Site<>{SiteCollection.URL}

This resulted in the following:

SP2013SearchNoHover_1

All the site collections, apart from the one where the web part resides, is shown! Nice 🙂 The only thing that kind of annoyed me was the hover panel with the preview of the site. I really didn’t need this and it really made the web part slower. So how to get rid of the hover panel? Follow me:

  • Go to the home page of your site collection
  • Go to Site Settings
  • Click on Master pages and page layouts
  • Click on Display Templates
  • Click on Search
  • Download a copy of the Item_Site.html display template
  • Edit the template and rename it within the <title> tag
  • Remove the following two lines:

ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();

  • Save the template
  • Upload it back to Search folder within Display Templates and don’t forget to publish
  • Edit the Search Results web part
  • Click on Display Templates
  • Click on Use a single template to display items and select your Display Template

This is the result:

SP2013SearchNoHover_2

The site preview is gone. Awesome!

 

You Might Also Like

3 Comments

  • Reply
    Brent
    April 30, 2015 at 10:14 pm

    It may have taken a while for anyone to say so, but thank you for this! Was exactly what I needed.

    • Reply
      Jasper Oosterveld
      May 1, 2015 at 9:31 am

      Thank you Brent, I really appreciate your feedback 🙂 Happy to help out!

  • Reply
    Joe
    May 27, 2015 at 4:42 pm

    Yes, thank you!

    Do you know how to turn off the preview for a Script Editor web part? I am unable to do anything because the preview overlays the code and there is no way to move it out of the way. Incredibly frustrating. Try explaining to your boss that you can’t edit your code because you can’t see it!

    Thanks

  • Leave a Reply to Jasper Oosterveld Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.