Search look and feel

Change the search "No Results" message, the search bar placeholder, and hide individual tags from search results.

Change your search bar placeholder

This script replaces the standard placeholder that appears in your search bars. You can use whatever sentence you like!

To use these, copy the relevant code at the very bottom of the Body template (if you're not sure how to do this, see here).

 Replace Type here... with whatever you like!

<script>
$(function() {
$(".hg-search-bar .form-control").attr("placeholder","Type here...");
});
</script>

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.

Script

Go to Settings > Style, click on Custom HTML and select Body.

Copy the script text below and paste it into the Body window.


<script>
//customize the "no results" text on search results screen
$(function(){
  if($('.hg-search-page') && $('.hg-search-page').length > 0){
    $('.no-results-msg').html('<p>Replace this with the custom search text of your choice. You can style it using standard html</p>');
  }
});
</script>

This script will replace the "No results found" text in the screenshot above with the text between the <p> </p> tags. Update the text by editing the highlighted text above.

You can style the text in the script using html.

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

Here's a sample script:

And the output it produces:

Hide tags from Search Results

KnowledgeOwl search results will automatically display all tags assigned to a given article :

Sample of Tags showing in Search Results

However, if you're using tags for custom filters in the Manage Articles interface, you might not want those internal tags to be shown in search results.

You can mark tags like this as hidden from readers. Hiding a tag from readers:

  • Keeps it visible in the article editor and category editor
  • Allows it to be used as a filter in Manage Articles custom filters
  • Prevents the tag from appearing in search results in your knowledge base
  • Prevents the tag from appearing in the typeahead suggestions when a reader types ":" to begin a tag search

To hide an existing tag from readers:

  1. Go to Library > Tags.
  2. Click to select the tag you'd like to hide from readers.
  3. Click on the Edit link.
    Select the tag you'd like to hide and click Edit
  4. In the edit pop-up that appears, under Visibility, check the box next to "Hide tag from readers."
  5. Click the Edit Tag button to finalize your changes.
    Check the box to Hide tag from readers, then click Edit Tag to finalize your changes
  6. Regular tags will have a normal tag icon in the Tags Library; tags hidden from readers will have a padlock icon. Here, "javascript" is a tag readers can see, and "tipsandtricks" is hidden from readers: