Tuesday, April 15, 2008

Adding Search to Your Site

or . . . Google Scores Another HitI had planned to write an article about adding search to your site. After all, Google has become the way people use the Web. “Google it” is now a household phrase. And yet, many sites still don’t have a search feature in place.The reasons for this seem to be primarily that until recently, it’s been a big deal to add search. Big companies with big budgets have typically relied on commercial search software and/or online search services. The price tags for these search engines are fairly high. Well out of range for smaller businesses or for personal sites. There have been two options available for these latter groups: hosted search solutions and do-it-yourself scripts you (or your developer) can snatch off the Web. The price is right for both of these options, with some being free and others having nominal fees. They may not come with all the bells and whistles of a larger search utility, but I’ve used them and have found them to be more than adequate.


My original plan when I sat down to write this article, then, was to check out several options from all three types of search: commercial, and freebie or low-cost hosted search engines and scripts for search engines. Then, I found Google’s Custom Search Engine and it was all over. They made it sounds so SIMPLE. And it harnesses the power of Google. And you can tell it to just search your site or to search the whole Web. I was hooked! I spent the rest of the afternoon giving it a test drive. The Custom Search Engine is still in beta but what I’m seeing so far is excellent.



If you’ve read my blog or Site Redesign and Findability article, you may know that I have a site for my psychotherapy practice that’s in serious need of a redesign. Since I’m planning on a major overhaul of the site and since I use that site when I’m wearing my psychology professional hat, I was eager to use it for my Custom Search Engine trial. First I’ll tell you about creating and customizing your engine and then I’ll tell you a bit about what it does, based on my experiences so far.


Creating Your Custom Search Engine


Let me begin by saying that for some reason, new stuff often scares me. I have tons of self-confidence in some areas of my life, but figuring out how to install the search engine wasn’t one of them. In other words, take heart, novices . . . if I can do this, you can, too.


And frankly, in a word, it was EASY. Even for me. Google’s directions are clear and relatively consise. However, I’m going to summarize them and hopefully make it even easier for those of you wanting to get up and running quickly with a fairly basic install:




  • The first thing I would do is to create the page you want your search results to be displayed on. I just named mine “search.html” and included all the header (logo and global nav) and footer info I have on each page in my site and left the rest blank. This makes my search results page look like every other page on my site. By inluding the navigation links, users can either click on the search results or go back to the main sections of the site. Don’t do anything else with this page yet — no need to even upload it because you’ll be adding some stuff to it.

  • If you don’t already have a Google Account, you’ll have to create one. Once you have an account, you’re ready to go ahead and start filling out the form to create your engine. They’ll ask you to name your search engine and give it a description. If you don’t create your own custom search page (like we did in the step above), Google uses these at the top of your SERP (Search Engine Results Page). Since we’re using our own logo, the name and description don’t show up on your SERP. However, they may be used as part of Google’s algorithm so I’d put some thought into what to put here.

  • After these 2 items, you have to list some keywords. There’s a limited amount of space for this but there was more room than I expected. I was able to include the following before it cut me off: psychology psychotherapy “mental health” counseling depression dissociation “eating disorders”. I’m not sure about this, but if I understand it correctly, the keywords you list might help people find your site, perhaps even help your site’s ranking. (Anyone know for sure about this?) I’m not sure if it does anything for your internal search or not. Once I had my search installed, I couldn’t notice any difference between searches for a word I had chosen as a keyword vs. for one that was not.

  • The next step is to choose which pages or site(s) you want your search engine to crawl. You can easily add or exclude additional pages later so if you’re like I was and eager to see it in action, just go ahead and list your entire domain. If you want to know more about the nitty gritty of adding and excluding stuff, Google has a great page explaining it. Once you enter your URLs, you choose whether you want Google to search only your site or whether you want to include results from the whole web.

  • Unless you’re a non-profit, university, or government website, you’ll have to agree to have Google sponsored ads on your page. But you can choose later where you want them to appear so that’s cool.


  • Believe it or not, that’s basically it as far as creating your search engine. You agree to the terms of service and click “Finish” and voilá! You have a custom made, Google-powered search engine for your site. Of course, it won’t do you much good unless you actually put in on your site, but Google makes that easy, too.


Customizing Your Site With Your Search Engine


Once your engine has been created, you’ll have a Control Panel link you can click on. The control panel has the following navigation links across the top:



  • Basics

  • Sites

  • Refinements

  • Look and feel

  • Code


  • Collaboration

  • Make money

  • Advanced

  • Preview


To continue in the spirit of getting things up and running quickly, I jumped straight to the “Code” link. Here’s what you do there:



  • There’s more than one way you can display your search on your site. Since we’ve created a special custom search page (remember our search.html?), skip the first option Google gives you, where it says “Search box code for your website” and looks like this:


Skip the part that says Search box code for your website




  • Instead, look below the box of code to a line that says: “Search box and search results code for your website”. Click on the “+” sign in front of “Search box and search results code for your website” to open that area:


Search box and search results code for your website



  • Choose the Google logo you want for your site. If the background color of your site is either white, black or gray (#B8B8B8 of all things!), you’re in luck since there’s a logo for each of those background colors. My home page, unfortunately, is in-your-face purple. However, they also have a nice-looking watermark logo that requires a bit of JavaScript (which they provide) so that one was fine for my site.

  • After you choose your logo, look for the line that says, “Specify the URL of the page on your site where you want the search results to appear”. This is where you enter the url of the page you built in the first step. Even though you haven’t uploaded it yet, go ahead and enter the URL. For example, mine was http://www.susanlitton.com/search.html.

  • Below that, you specify where you want your ads to appear. I put mine only on the right.

  • After that are two boxes of code. The first one is the code that you put on each page of your site where you’d like a search box to appear. I wrapped the whole thing in a div, absolutely positioned it, and added that code snippet to each page of my site.

  • The second code box is what you paste into your search.html page (or whatever you named your search results page. Since I created a page with header and footer info, I put the search code in the area between the two.

  • Upload each page where you added code (including your results page) and voilá! Your site now has a search engine!



Features of the Custom Search Engine


So now that we have it, what exactly is the Custom Search Engine? Basically, it’s like having your own personalized “mini-Google” that only searches your site. Ok, so it COULD search the entire web, but I suspect most people will want to restrict the search. And speaking of restricting, you don’t have to submit your entire site. You can tell Google to totally ignore certain pages, or you can include those pages but request that results from them be listed after results from your more important or relevant pages. For example, when I first installed my Google Search, I discovered that Google was not only searching my psychology site, but also all the other folders I have in my root folder. More specifically, I have a folder named “school” that holds various projects and jump pages I’ve built as a student. Many of those were actually rating higher than my therapy site. For example, when I entered the word “anxiety” in the search box, the first item returned was from a blog I made for a course in CSS. I was curious as to why it ranked so high because that was a techy/artsy blog. Didn’t have anything at all to do with psychology. When I checked, however, I had titled one of my posts “Anxiety” so I guess since it was header text and internally linked, Google flagged it as important. To include or exclude certain pages or folders from your search, go to your Control Panel and click on “Sites”.


Another feature you might enjoy knowing about is the “Look and Feel” link in your Control Panel. From here, you can customize link and text color, etc., as it will appear on your results page:


Customize your search results page


I’ve only skimmed the surface in this article about what a Google Custom Search Engine can do. Other features include:



  • Invite friends and trusted users to contribute to your search engine and become co-editors

  • Make money by linking your Custom Search Engine with your Google AdSense account

  • Add other sites to your search engine’s index as you surf the web


  • Provide refinements on your results page to make it easier for searchers to find what they’re looking for


Even without having tried these additional features, however, I’m sold. Two thumbs up for Google’s Custom Search Engine!

No comments: