Customize the search "No Results" message

By default, searches that return no results display the text, "No results found":

You can customize the text in that message using this script. To do so:

  1. Go to Settings > Style
  2. Below the Preview pane, be sure that Custom HTML is selected.
  3. In the Custom HTML  dropdown, select Body.
  4. Copy the script text below and paste it into the Body window.
    <script>
      //When no search results are found, replace default "No results found" text with text of our choice
      $(function(){
        if($('.hg-search-page') && $('.hg-search-page').length > 0){
          $('.no-results-msg').html('<p>Custom no results message</p>');
        }
      });
    </script>
  5. On row 5, replace Custom no results message with the text you'd like displayed instead. Be sure you don't delete the <p> and </p> tags though!
    You can style the text in the script using html.
  6. There isn't an easy way to Preview these changes, so Save and check them out.

Sample

Not sure what to include? Some ideas include:

  • A link to your contact form
  • The email address of your support team
  • If you have a guide on how to use the knowledge base or specific guided search instructions, include a link to those

For example, here, we include a link to our contact form and the text "Sadly, this search returned no results. But you can Contact Us for more help.":

Sample script using the text described above

And the output it produces:

And the No Results message it produces!