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.

SharePoint Search Results Web Part with suggestions SharePoint Search Results Web Part with suggestions

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.

SharePoint Search Results Web Part with suggestions hidden

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.



See also

Leave a Reply

Your email address will not be published. Required fields are marked *