Easy Code to Add Google Site Search to Your Website


If your website consists of more than just a few pages, it's important to have a way for your visitors to search your website. There are several ways you can accomplish this. One way is to use a pay site search company which will index your site's contents and provide you code for a search box. This may give you more control over the results returned for a specific search term or phrase. The down side is, you have to pay.

Another way to put site search to your website is to create your own index of your site's contents and write your own search program. This gives you complete control over the results returned. The down side, it's very complicated to write code that can create an index and return results from that index based upon a specific search term or phrase.

Another way is to simply put the code for a search box that calls the search program of one of the major search providers, like Google. Google is the king of search providers, garnering 90 percent of the market according to So when your visitors see a Google search box on your site, it will be a familiar item. The down side is that Google is in the search business to make money, so there will be some not from your website results returned with your sites results.

Some authors will tell you that you need to have an account with Google in order to create a Google Site Search box. This is entirely untrue. If you want to earn a commission when someone types certain specific terms or phrases into your search box, then you need an account with Google's Adsense program. However, not everybody is accepted for the Adsense program. And you're going to get paid for searches of your own website.

The code for Google site search is shown below, just paste this code into the desired location on your website.

<form method="get" action="">
    <img src="" alt="Google" />
   <input type="text" name="q" size="30" maxlength="255" valu="" />
   <input type="submit" value="Search Site" />
   <input type="hidden" name="sitesearch" value="" />

One thing you'll want to do is replace the link "" with the URL of your website (unless you want to post a form to search my website. In that case thank you.) And just above that you may want to replace the "Search Site" with Search (the name of your website). Or just leave it "Search Site".

After you make those modifications, type in a search term or phrase and give it a test. You can's get the services of a powerful search engine on your website any easier or cheaper than this.

Learn more at

More HTML Code:
• HTML Image Basics
• Keywords Meta Tag Generator
• HTML Text Tags Basics
• Easiest HTML Calculator Eample Code
• HTML Frames Basics
• Use fieldset to Organize Form Elements
• Divide a Table Into Head (thead), Body (tbody), and Footer (tfoot) Sections
• What is HTML?
• How to Code HTML Lists
• Form Input Labels