X

Hiding search suggestion in Search Results Web Part

I have page in SharePoint where users can search for specific type of items and see different results in Search Results Web Parts. The page I have has eight results web parts and when nothing is found I want to keep results web parts laconic and minimal so they don’t waste space on screen.

What I want is shown on following two screenshot fragments.

Easiest thing to do is using Script Editor Web Part and add some styling to hide the suggestions block. Here are styles I added.

<style>
    #NoResult div, #NoResult ul {
        display: none
    }
    #NoResult .ms-srch-result-noResultsTitle {
        display: inherit
    }
    .ms-srch-result-noResultsTitle {
        padding-bottom: 0px;
    }
</style>

Now suggestions block is hidden and web parts with no results doesn’t take room so much anymore. What I have now is shown on the following screenshot fragment.

In case of sites with more custom styling I suggest to have custom stylesheet that is included to masterpage. If it’s just one page like I have then it’s also okay to go with Script Editor Web Part.

Liked this post? Empower your friends by sharing it!
Categories: SharePoint

View Comments (2)

  • Why not simply use the 'EmptyMessage' WebPart Property? You can Export the Webpart, edit the message and re-add the Webpart and you are clean. No additional CSS needed.

Related Post