Add Google Site Search to your SilverStripe Site.
- SilverStripe 4
Adds the ability for a user to search the site through Google Site Search. This is done via a new Page in the CMS (GoogleSiteSearchPage) and results are fetched from Google via ajax. The search form and results are free to style via CSS.
Sign up for www.google.com/sitesearch
Install this module to your site root folder named
Rebuild your database using
Enter your Google CSE CX and key values in the CMS under a new instance of the newly added GoogleSiteSearchPage or through the config flag
Add the default search form to your controller (or use your own extension for styling / changing the form). In mysite/_config/googlesitesearch.yml add the following:
Add a search form to your
Ensure you read the Google Custom Search Terms before installing the module and agree to the terms and conditions https://www.google.co.nz/cse/docs/tos.html
Full HTML control is available by providing a custom
template on the page. Since the results are loaded via AJAX, John Resig's Micro Templating
is used to provide basic utility templates in results, header and footer
Out of the box a basic header message and pagination in the footer is provided but you are free to alter the page as you need to. More documentation on the available data to output to the template (such as file information) is at developers.google.com/custom-search/v1/using_rest