Skip to main content

Add Google search results to MindTouch Search (SAP KC)

MindTouch allows custom HTML/Javascript widgets to be included on pages. With the Google Custom Search widget, you can include search results from external sources within your MindTouch site.

Why use the Google Custom Search widget?

After completing this how-to, you will have your MindTouch search results integrated with Google Custom Search results, as seen below:


Step 1: Create a Google Custom Search Engine

Sign into to create a Custom Search Engine. Within Google's editor, you can customize the interface for the search engine, including the sites to search.


In this case, the Custom Search Engine only searches the specified external sites, but it can be configured to include results from across the internet. (Note: Certain features, such as removing ads in search results, require an upgrade to the paid Google Site Search.) 

Step 2: Copy The Widget Code

On the Search Setup page, click Get Code:


This brings up a screen with the widget code to insert into MindTouch:


Keep this page open, as it will be used in the next step.

Step 3: Create A New Search Results Page

Now, we will create a page to display the custom search results.

  1. Download the file  Search.mtarc.
  2. Visit the homepage of your site.
  3. Select Page Options > Import here and select the Search.mtarc file which was just downloaded.
  4. Visit and click Edit Page

  5. Find the section containing
    and paste in the value from the Google Code page in Step 2.
  6. Save the page.
  7. You should now have a blank search form which is ready to be used.


Step 4: Customize The Search Form

Try a sample search to ensure the widget has been installed correctly. You can customize various search options below:

  • Customize the number of search results and other options with this line:
        var uri = site.api & 'site/query' & {q: query, limit: 7};
  • Customize the wording for the HTML input or the <h2> title tag.
  • Customize the CSS included on the page to match your site's look and feel.

Step 5: Update the Default Search Form

If you have a custom skin for on your MindTouch site:

  • Change the search form submit location to /Search
  • Use "q" as the search parameter

If you have a custom header, add the following Dekiscript to your Header template:

<form action="/Search">
    <input type="search" name="q" placeholder="How can we help you?"></input>