pLog Google Plugin

The LifeType Google plugin is a very simple plugin that will highlight all the search terms if somebody is coming to our page from Google (it will scan the referer) At the moment, Google is the only search engine detected and handled correctly but more will be added in the future.

The plugin must be copied to the root folder of pLog. You will know that it works because you will see a new plugin in the "Plugin Center" section in the administration interface of you blog. pLog 0.2 or higher is required for this plugin to work.

The Google plugin will automatically highlight all the words from the search string, using a set of colours similar to what the "real" Google users. Additionally, we can make the plugin to show a greeting text to Google visitors, showing which words have been highlighted and which colours have been used.

First of all, to get the plugin working we have to add the following to the header.template file:

{$google->start()}
  
And the following to the footer.template file:
{$google->end()}
  
This is done to tell the plugin where our page starts and where our page ends. Should you wish to reduce the places where the plugin searches for matches, then place those "markers" somewhere else in the page but do not forget one of them, otherwise the client browser will probably only receive a blank page.

To enable the greeting text, we have to literally add the following string anywhere in the page where we'd like to show the greeting to Google users:

[googleplugin]
 
It is recommeded to add it somewhere close to the top. The Google plugin will replace that text for a nicer greeting text if there was any match found. If not, the text will be replaced with an empty string (so that it will not appear if there are no matches) At the moment the text is in English and it can only be changed by editing the code of the plugin but future versions of the plugin will allow to configure the text too.