Google Custom Search for WordPress

One of the main reasons I moved away from Blogger to WordPress was the difficulty in making Blogger searchable. Ironic for a service owned by Google! Every time I did a search on my site it would only every return one result, this is because it treated the whole site as one big page, so even if I had, for example 5 posts about ‘NAS’, my search would only return the main page.

WordPress’s search is not the best either so let’s make sure your site search is powered by Google Custom Search and do not use the built-in search feature of WordPress. WordPress search returns less relevant results and the other advantage is that it will reduce strain on your WordPress server /database since the search queries will be handled through Google.

Alternatively, if you plan to continue with WordPress built-in search, use the Nice Search plugin. It creates better permalinks for your WordPress search pages (/search/tutorials vs /?s=tutorials).

Custom search is really easy to set up. Follow these steps…

1. Go to CSE site https://cse.google.co.uk/cse/all Log into your Google account if you need to.

2. Click Add, then add your site’s address to the ‘Sites to search’ box. Give your search engine a title so that you can identify it later if you have a few of them. Click Submit

3. That’s it! (almost)

4. On the following page click on ‘Receive Code’ to get the HTML that you need to add to your blog to use the customer search engine.

5. Now go to your WordPress site and go to Appearance > Widgets. Add a new HTML widget to your site and paste in your code from the step above.

Now when you use your new search widget you will get fully customised search results from your site. Google will also increase your search results presence in it’s general search engine output.

You can increase the quality of the results by adding a site XML to the CSE site under the ‘Advanced’ tab. You can generate this file for your site using the plugin ‘Google XML Sitemaps’.

You can also change how the search results are displayed to some extent by amending the CSS for the results. Labnol has a nice guide to what tweaks are possible here: http://www.labnol.org/internet/google-custom-search-css/28360/

 

Leave a Reply

(email optional)