Custom Search Engine (CSE) Search Box Not Showing

Integrating Google Custom Search Engine (CSE) into your website or blog is a pretty easy thing to do. Just open a Google account (if you already haven’t got one!); go to CSE page and create a new search engine; get the code and paste it in your website.

Easy like a Sunday morning! And you get all the benefits of using Google custom search engine.

But at times this trivial task turns out to be like Monday blues! One of the most annoying problems is that the CSE search box does not appear and you simply get no idea why this is happening. Well, I have noticed two small mistakes which, if made, can make the CSE search box disappear. Let’s understand these problems and their solutions.

Reason 1: Unclosed Form Tag in CSE

If you have another form on your web page and if you forget to close the CSE form tag –the CSE search box may not appear (especially if CSE code is coming after the code of the other form). Forgetting to close form tag with </form> is a common mistake made by web developers. See if that is the case with you too.

Custom Search Engine’s Code Pieces

For implementing Custom Search Engine on your webpage, Google provides you with a three part code. These parts are:

  • A JavaScript code
  • Search box markup ( <gcse:searchbox></gcse:searchbox> )
  • Search result markup ( <gcse:searchresults-only></gcse:searchresults-only> )

It is important that both the search box markup and search results markup appear on your webpage. If search box markup will fail to detect search results markup –search box will not appear.

ALSO READ:  Gmail to Give Reason of Marking a Message as Spam

This problem is common in Two-Column layout of Google CSE.

In WordPress, for example, every theme has various types of web pages, namely post, page, category etc. Usually people add search box markup in the HEADER portion of the code. You’ll need to add the search results markup in the code of every type of page at a position where you wish to show Google’s search results. If you’ll add this markup only, say, in the file that displays post (mostly single.php) –the search box will not appear in other types of web pages.

I hope this article was useful for you and saved you some time. Please let me know if you have any questions on this topic. Thank you for using TechWelkin.

Leave a Comment

Your email address will not be published. Required fields are marked *