icon Google Custom Search
Created by Orckestra

Show technical information 

How to add Google-based search to your website

You can implement search in one of the following ways:

  1. Have a dedicated page where you have both a search form and search results.
  2. Have a search form displayed on all pages and have a dedicated page for search results only.

Adding both a search form and search results to a single page

To display the search form and results on a single page:

  1. Get the search engine unique ID.
  2. In the Content perspective, edit a page.
  3. Insert the Composite.Search.GoogleCustomSearch.Form function or add the following code:
    Expand code
  4. Specify the required parameters:
    1. EngineId: A unique code that identifies a custom search engine for your website.
  5. Make sure that:
    1. ShowResults is set to 'True'.
    2. ResultsPage has no value. (Any value here will be ignored given the ShowResults is set to 'True'.)

Adding a search form to all pages and search results to a dedicated page

How to implement search results on a page

  1. In the Content perspective, edit a page that will serve as a dedicated page for search results.
  2. Insert the Composite.Search.GoogleCustomSearch.Results function or add the following code:
    Expand code
  3. Specify the required parameter:
    1. EngineId: A unique code that identifies a custom search engine for your website.

How to add the search box to multiple page

To display the search box on multiple pages, consider inserting Composite.Search.GoogleCustomSearch.Form function in the template(s) these pages are based on.

  1. Get the search engine unique ID.
  2. In the Layout perspective, edit a page template.
  3. Insert the Composite.Search.GoogleCustomSearch.Form function or add the following code:
    Expand code
  4. Specify these parameters:
    1. EngineId: A unique code that identifies a custom search engine for your website.
  5. Make sure that:
    1. ShowResults is set to 'False'. In this way, a dedicated page is required for search results.
    2. ResultsPage has a page specified. (The value here will be in use given the ShowResults is set to 'False'.)

Customization

You can customize and style the search form and the search result list in your Google Search account.

Important notes

  1. The commercial Google Site Search edition does not work with the package. Use Composite.Search.GoogleSiteSearch instead.
  2. You should get the search engine unique ID (similar to '003098970302671473565:zufgbcyhdqs').