Google Site Search
Created by Orckestra
Show technical information
How to implement search results on a page
- Get the search engine unique ID .
- In the Content perspective, edit a page that will serve as the page for search results.
- Insert the Composite.Search.GoogleSiteSearch.SearchResult function or add the following code:
Expand code - Specify the required parameter:
- SearchEngineId: The parameter specifies a unique code that identifies a custom search engine for your website
- Optionally, specify these parameters:
- SearchTerm: The word or phrase to search for. By default the 'q' query string value will be used.
- ResultsPerPage: The number of search results to display on the page ('10' by default)
- If necessary (e.g. for localization), change the texts displayed with the search results.
How to add the search box to multiple pages
To display the search box on multiple pages:
- In the Layout perspective, edit the template(s) these pages are based on.
- Insert the following HTML form markup where necessary:
Expand code - In the action attribute, specify the page with the Composite.Search.GoogleSiteSearch.SearchResult function (Insert | Page URL).
- Save the template(s).
How to localize the search results
As you provide new text strings, remember to use the system-defined parameters presented as {0}, {1} etc where appropriate within the strings.
- Edit the Composite.Search.GoogleSiteSearch.SearchResult function
- Select, and change the text in, the following parameters:
- TextTitle: The text in the page title. By default '"{0}" - Search' where {0} stands for the search term specified.
- TextResults: The heading for the search results. By default '{0} results for <em>"{1}"' where {0} stands for the number of results and {1} - for the search term specified.
- TextNoResults: The heading for no results. By default 'No results for <em>"{0}"' where {0} stands for the search term specified.
- TextSuggestion: The text used with the suggested search term. By default 'Did you mean <em>"{0}"?' where {0} stands for the search term suggested.
- TextButtonSearch: The text on the Search button ('Search' by default)
Important notes
- The free Google Custom Search Standard Edition does not work with the package.
- Your website should be registered with a paid Google Site Search edition.
- You should get the search engine unique ID (similar to '003098970302671473565:zufgbcyhdqs').
- You should keep the system-defined parameters presented as {0}, {1} when changing the text strings for the search results.
Customization
You can customize the layout of the search results by editing the style sheet:
~\Frontend\Composite\Search\GoogleSiteSearch\Styles.css