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:
- Have a dedicated page where you have both a search form and search results.
- 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:
- Get the search engine unique ID.
- In the Content perspective, edit a page.
- Insert the Composite.Search.GoogleCustomSearch.Form function or add the following code:
Expand code - Specify the required parameters:
- EngineId: A unique code that identifies a custom search engine for your website.
- Make sure that:
- ShowResults is set to 'True'.
- 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
- In the Content perspective, edit a page that will serve as a dedicated page for search results.
- Insert the Composite.Search.GoogleCustomSearch.Results function or add the following code:
Expand code - Specify the required parameter:
- 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.
- Get the search engine unique ID.
- In the Layout perspective, edit a page template.
- Insert the Composite.Search.GoogleCustomSearch.Form function or add the following code:
Expand code - Specify these parameters:
- EngineId: A unique code that identifies a custom search engine for your website.
- Make sure that:
- ShowResults is set to 'False'. In this way, a dedicated page is required for search results.
- 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
- The commercial Google Site Search edition does not work with the package. Use Composite.Search.GoogleSiteSearch instead.
- You should get the search engine unique ID (similar to '003098970302671473565:zufgbcyhdqs').