How to Integrate Google Search in WebHelp Output
See how you can integrate a Google Custom Search Engine into WebHelp output.
To enable your WebHelp system to use Google Search, follow these steps:
- Go to the Google Custom Search Engine page using your Google account.
- Press the Create a custom search engine button.
-
Follow the on-screen instructions to create a search engine for your site. At the end
of this process you should obtain a code snippet.
A Google Search script looks like this:
<script> (function() { var cx = '000888210889775888983:8mn4x_mf-yg'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); } )(); </script> - Save the script into a well-formed HTML file called googlecse.html.
-
In Oxygen XML Editor, click the
Configure Transformation
Scenario(s) action from the toolbar
(or the Document > Transformation menu.
- Select an existing WebHelp transformation scenario (depending on your needs, it may be with or without feedback, or the mobile variant) and click the Duplicate button to open the Edit Scenario dialog box.
-
Switch to the Parameters tab and edit the
webhelp.google.search.scriptparameter to reference the googlecse.html file that you created earlier. -
You can also use the
webhelp.google.search.resultsparameter to choose where to display the search results.-
Create an HTML file that contains the Google Custom Search Engine element
gcse:searchresults-only. It is recommended that you set thelinkTargetattribute value tofrmfor frameless versions of the WebHelp system or tocontentWinfor frameset versions of WebHelp. The default value is_blankand if you do not specify a value the search results will be loaded in a new window. -
Set the value of the
webhelp.google.search.resultsparameter to the location of the file you just created. If this parameter is not specified the following code is used:<gcse:searchresults-only linkTarget="frm"></gcse:searchresults-only>.
-
Create an HTML file that contains the Google Custom Search Engine element
- Click Ok.
- Run the transformation scenario.