Posts for 21st August 2010

There are several guides on the web covering the addition of Google based search to FlatPress sites.

This plugin takes a slightly different approach by extending the existing SearchBox plugin to also support Google searches and hence the possibility of generating income (if you are lucky) via Google AdSense.

First download the GoogleSearchBox plugin and copy into your fp-plugins folder.

Now go to Google and sign in to you Google account. Select the Custom Search product and generate a search engine for your site. For the look and feel of your custom search engine choose Iframe and then get the code.

When generating the code for you custom Google search engine it is necessary to provide the url for the static page on your FlatPress site where search results will be displayed, for example

On your FlatPress site generate a static page for the Google search results to be displayed on giving it the same name you used previously, e.g. GoogleSearchResults. Into this page paste the search results code provided by Google, for example:

<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 400;
  var googleSearchDomain = "";
  var googleSearchPath = "/cse";
<script type="text/javascript" src=""></script>

Now go the Plugins page of you FlatPress site. First disable SearchBox. Then enable GoogleSearchBox and go to the configuration page for GoogleSearchBox.

Decide on how you want the search box to be displayed. In its concise form a text box and search button are displayed. The full search box allows the user to decide what form of search to perform - titles only, full or via Google.

In the Target field place the name of your static page where Google search results will appear, e.g. GoogleSearchResults.

In cx enter the unique Id of your search engine. This can be found in the Search box code provided by Google.

The cof field controls where adverts are displayed by Google in the search results. As you change the position you want advertising to be placed in the Google control panel this value will change in the Search box code window. Currently the values appear to be

  • FORID:9 to display adverts to the right
  • FORID:10 to display adverts on the top and to the right
  • FORID:11 to display adverts and the top and bottom

The ie field is the encoding for your Google search results and again can be found in the Search box code generated by Google.

Finally, go the the Widgets control panel on you FlatPress site and place the GoogleSearchBox widget into the appropriate bar.

Note, if a visitor has javascript disabled then they will not be able to issue a search against Google. Instead the search will revert back to using the built in facilities provided by FlatPress.