Wednesday, November 15, 2006

 

Google Custom Search & blogger

Google Custom Search is a cool and relatively simple way to create a vertical or niche search engine for whatever topic you choose with a range of options.

To create your own search engine visit http://www.google.com/coop/cse/ and once your in simply give your search engine a name, description and then you can tune your results by adding keywords for example let's say that my search engine is Australian travel I might choose Australia "travel guides" "city guides" accommodation holiday etc.

Next step is adding a list of sites you've hand selected that are relevant to your chosen topic and you can easily add more later on, also choose if you want to search the web, with an emphasis on your listed sites or just the sites you list. Then choose whether others can contribute and move on to the next step.

Plenty of options here and your next step is to start refining the sites you've added by first of all creating labels to apply to those sites. This is kind of like sub topics under your chosen topic. An example would be under Australian Travel you could have labels like accommodation, flights, city guides, landmarks, etc. Under the Refinements section you'll find Manage Refinements > Add Refinement, add the name of your label ie. accommodation and choose whether to search all sites, with an emphasis on that sites with that label, or only sites with the label. A tip is to choose only selected sites otherwise if there is any 'authority sites' in your list even though you may not give them that label they can still out rank labelled sites making your labelled refinements seem irrelevant. Next step is on to the Sites section and apply the refinement label to sites you choose. If it's a large topic it will take a little time to add all the refinements and apply the labels to selected sites.

There is a range of other options for your search engine including the Look and Feel - add a logo, choose colors, Advanced - work with xml, Make Money - ad adsense, Collaboration options and Preview. Sounds like fun for later, now let's get it working on a blogger or blogspot.com blog.

Step into the Code section and you'll see a number of options to either have a search box that where results are displayed on your search homepage and a couple of others, the one I liked was 'Search box and search results code for your website' so that the results are displayed on my site.

Here's how I added it to my blogspot blog:
Put your homepage URL in the specify page section ie yoursite.blogspot.com and save changes. Copy the Search Box code and open your template at blogger.com and choose where you want your search box to appear, for me I added it to my sidebar just under the links section. You may also want to adjust the length of the input feild to suit your template - in the Google search Box code look for input type="text" size="40" - I changed my size to 30 to make it look neat.

Then copy the Google Search results section and I added it in the main body section of my site just under where it said -
<!-- Begin #main -->
<div id="main"><div id="main2">

Then I added a containing div to which I added a header and a way for the user to close out of the results div and return to the blog. Like so:
<div id="holder" style="">
<div style="padding: 3px; background-color: rgb(35, 68, 85); height: 30px; color: rgb(255, 255, 255);"><span id="close"><b><a href="http://yoursite.blogspot.com">Close X</a></b></span> My Search</div>
Google Search results code
</div>

Then added to the styles:
#holder {
background-color:#ffffff;
border:1px solid #cccccc;
padding:4px;
width:auto;
position:absolute;
top:10px;
left:10px;
z-index:30;

}
# close A {text-decoration:none;color:#000000;}


With so many blogger templates you'll probably need to play with positioning, colors etc. to suit yours and may need to adjust the search results width in the Search results code ie. var googleSearchFrameWidth = 725.

Update: the team at Gold Coast Chat Australia have taken over the search engine and are featuring it on their site which will hopefully see it build up into something even more useful.

There is also a great article on CSE's at Google Blogoscoped





<< Home

This page is powered by Blogger. Isn't yours?