I’ve seen some very nice Google-sponsored search systems on sites like StickerGiant and am wondering how hard that is to implement? I know you’ve written about how to add a Google search box on your site (see How to add a Google search box to your site), but I’m talking about how to have the search results on my site itself.
I’ve been digging into this for Ask Dave Taylor too since I have tons of articles here on the site (over 1500!) and when I look at the questions people have, I know that if you could just dig through the archives, you’d find your answer more easily than waiting forever for me to respond to your question.
Funny you’d mention StickerGiant too, because the owner, John Fischer, is a pal of mine. So I got to see how his search works too, and it’s really quite simple.
The starting place for all of this is the Custom Search Engine page at Google.com.
The first step therein is to click on create a custom search engine, at which point you get lots of options. Let’s start with the basic configuration options:
Some of these steps are less relevant when you’re creating a one-site search engine, but nonetheless, a nice search engine name and description are useful, as are some keywords, requested in the next section:
If your site has information in multiple languages, definitely make sure you choose the predominant language here, and if you’re just in English, like I am, then the default works just fine.
Next you need to decide if you are going to create a search engine for multiple sites or just one. Since we’re doing an on-site engine, let’s just stick with one for the results, as you can see:
Since you want to search your entire site, use the notation shown, of www.xxx.com/* (most likely using www.xxx.com will work too, but the “/*” is what Google recommends, so it’s best to play by their rules!
As you can see, I’m opting for the free one, because I’m okay with ads showing up in the search results as long as I make a small slice of the revenue stream generated from those advertisers.
Finally, it’s time to click “Next”, at which point you can try out a few searches and ensure it’s working, then click “Finish” and you’re done!
Now the interesting part, customizing the appearance and getting the code you can add to your site so that the search actually works.
This is a bit more involved and our next stop on the journey is to get to the list of search engines you’ve created and click on “Control Panel”. Now you’ll see a strip of options along the top of the page:
&nbps; Business Edition | Advanced | Preview
To get the code you need for the page that’ll host the search results, click on Code. There are a couple of choices for what kind of behavior you want for the search: You want the default choice of an iframe, which gives you some simple code you can drop on all your pages for the search box and then lets you create a custom template page with code, also from Google, that incorporates the search results.
I’m going to create a new template page in Movable Type that includes the search results code so that I can update the data segments easily with latest posting information, etc. Assigning a specific URL to the search results page is a critical step. It looks like this:
Now Google offers up a block of code that implements the search box itself. When I paste it into this blog entry, it results in: