Use Google Custom Search Engine in KnowledgeOwl

Google Custom Search Engine allows you to create a custom search engine for your knowledge base powered by Google. It's free, but you are required to show ads unless you are a non-profit or a school. If that's not a dealbreaker for you, you can also monetize your knowledge base using Adsense.

You can learn more on Google's Custom Search Help or create a custom search engine here.

Implementing Google CSE in KnowledgeOwl

To integrate Google CSE in to your KnowledgeOwl knowledge base, you'll need two things:

  1. A page to hold your CSE code
  2. A search form to send your users to the search page

Creating a page to hold the search results

We recommend using a default category for your custom search. This will provide a nice blank canvas for the search input and results to be displayed. You can check the option to hide the category from navigation so it doesn't show up in your navigation.

The category description field is a convenient place to place your CSE JavaScript snippet. Using the Standard element type is the easiest to implement, though you may have to do a bit more work to override Google's default styles if you'd like a branded search form. 

Now's a good time to pause (and save), and check out your new search page! Click View Category at the top of the screen to see your custom search page in action.

Adding search forms to your homepage or articles

Allowing your users easy access to this search page is the next important piece of the puzzle. At its simplest, this could be set up with an ordinary hyperlink to the category page ("Click here for our search page").

You can go a step further by using an HTML form instead of a hyperlink. This will allow you to add a textbox, and pass the user's search terms as a query string to your search page. Google CSE automatically picks up queries embedded in the URL, so seamlessly integrating this new search capability anywhere in your knowledge base becomes a snap!

Below is an example of how this search form might look.

<form action="/help/search-results/" method="get">
   <input name="q" type="text">
   <button type="submit">Search</button>
</form>

Three important things to note:

  1. The form action points to the URL of the search "category page".
  2. The form method is "get".
  3. The text input name is "q".

The text input name you can actually change to whatever you'd like, be sure to make the necessary adjustments to your Google CSE code, so it knows to look for the query string by that variable name.

By including a form like the one above on your homepage or in your top navigation, your users will now have easy access to your Custom Search Engine!

A highly stylized search form