Google Custom Search Engine Support
The skin allows adding a Google Custom Search Engine search box in the generated site.
To enable CSE the /project/body/head/google-cse element should be set in the site.xml. The configuration parameters for the element are described below.
google-cse configuration
The /project/body/head/google-cse takes the following attributes:
| Attribute | Use | Description |
|---|---|---|
| cseId | Required | The ID from your CSE administration page |
| style | Required* | The CSE search box style, defined by Google CSE. This element is required for element-compact and element-two-col types. |
| type | Required | The type of the CSE result, see below for a full list of possible values |
The allowed type values are:
| Type Value | Description |
|---|---|
| element-compact | Compact search form and results in the nav bar |
| element-two-col | Results displayed in the main content section |
| google-hosted | Results displayed on Google webpage |
The other formats may be supported at a later time
An example configuration is shown below:
<google-cse cseId="001821074997410371686:oik3n7lzyvg" style="google.loader.themes.MINIMALIST" resultSetSize="google.search.Search.FILTERED_CSE_RESULTSET"/>
Generated Search Box
An example code for the search box is shown below, the actual box is in the navigation bar of this page
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('001821074997410371686:oik3n7lzyvg');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options);
}, true);
</script>