Google Site Search

google site search imageHave you ever done a Google search and when you clicked on a link it went to the homepage of the site and not to the information you were looking for.

Most of us take 1 millionth of a second to see it isn’t there and rather than try and find navigation to the page we click back and move on to the next search result.   I wanted a way to keep them from hitting that back button and moving on.

I like the site search on our blogs and went  looking for something to do the same on our web site.   I found Google Site Search.

Google Site Search is a great way to  let people enter their search term  and this time it will only search your site.   There is a good chance they won’t be so quick to click away once they see this search option. I’ve tested it on our Tucson Real Estate  site and it returns the exact page reference that came up in the original search  taking  your visitor  to the page they wanted in the first place.

Here is the process to put Google SiteSearch on your Homepage:

  1. Go to the Google Site Search Page
  2. check the agree to terms of service
  3. click the get code button
  4. Scroll down to the bottom option code window
  5. Reread 4.   There are three sets of code, you want the bottom one.
  6. Copy it.

Here is the catch, yeah there always seems to be a catch doesn’t there.   This code will produce 35 WC3 Errors on you homepage.

I found this on a routine check of our homepage on the WC3 validator page. It took me a few minutes to clean up the code so it would validate.  

Here is the process:

  • Change all  CAPS to lower case ex.  INPUT to input
  • Make all lines of code self closing including <br>   to <br />
  • Put all values in quotes ex. input type=”text”  NOT input type=text
    A rule of thumb is after = close in quotes
  • remove the </form> at the end
    it isn’t needed you’ve made all lines self closing
  • change checked to checked=”checked”

Here is the code as it should changed to validate.

   <!-- SiteSearch Google -->
        <form action=””/>
<input type=”hidden” name=”ie” value=”utf-8″/>
<input type=”hidden” name=”oe” value=”utf-8″/>
<table bgcolor=”#FFFFFF”><tr><td>
<a href=”“>
<img src=”” border=”0″ alt=”Google”/></a></td><td>
<input type=”text” name=”q” size=”31″ maxlength=”255″ value=””/>
<input type=”submit” name=”btnG” value=”Google Search”/><input type=”hidden” name=”domains” value=””/><br /><input type=”radio” name=”sitesearch” value=””/> WWW <input type=”radio” name=”sitesearch” value=”” checked=”checked”/> <br /></td></tr></table>

<!-- SiteSearch Google -->

 You can’t copy this code from the page it won’t work.  

I’m not the brightest bulb in the pack when it comes to this code in a post stuff.   Here is the googlesitesearch.pdf file.

  • Once it is open
  • select the I bar select function
  • swipe the code
  • copy it.

You can now paste it into your web page, changing the three references to “yourdomain” located near the bottom of the  code to . . . . . you got it, your domain.
DO NOT CHANGE names=”domain”

Once you have added and saved you can use the validator page to check for errors on your homepage.  

Assuming you didn’t have any errors before adding this code.   smiley face

I really like the functionality of this piece of code. It is just too bad that Google  would  provide a piece of code that is so obviously out of standard coding practices for today.

And if anyone can tell me how I can start putting code in a post that can simply be copied and applied.   Please let me know.