Have visitors search your website with free Google Custom Search

This package uses the Google Custom Search to execute keyword searches on your website.

Please note that Google Custom Search is a free edition. For the package that works with the commercial edition of Google Custom Search - Google Site Search - please see Composite.Search.GoogleSiteSearch.

Technical Information

The package provides two functions that uses Google Custom Search API to retrieve and display the search results.

Once you have created your Google Custom Search engine, you get a search engine unique ID (similar to '003098970302671473565:zufgbcyhdqs'). You should use this unique ID as a required parameter in the SearchForm function (see below).

The SearchResults function displays the search results on an ad-hoc page.

How to implement search results on a page

  1. In the Content perspective, edit a page that will serve as the page for search results.
  2. Insert the Composite.Search.GoogleCustomSearch.SearchResults function or add the following code:
     
    <f:function name="Composite.Search.GoogleCustomSearchResults" xmlns:f="http://www.composite.net/ns/function/1.0" />

How to add a search box to a single page

To display the search box on a single pages:

  1. Get the search engine unique ID .
  2. In the Content perspective, edit a page that will display the search box.
  3. Insert the Composite.Search.GoogleCustomSearch.SearchForm function or add the following code:
     
    <f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Search.GoogleCustomSearchForm"> 
      <f:param name="ResultsPage" value="fdc1d872-4dc8-4714-b587-5dec6865a25a" /> 
      <f:param name="EngineID" value="003098970302671473565:zufgbcyhdqs" /> 
    </f:function>

  4. Specify the required parameters:
  • ResultsPage: The page to display search results to display on
  • EngineId: A unique code that identifies a custom search engine for your website

How to add the search box to multiple pages

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

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').

Requirements

Composite C1 version 2.0 SP 1 or later

SHARE