Putting Google Search on Your Site

18 381 0
Putting Google Search on Your Site

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 5 Putting Google Search on Your Site In This Chapter ᮣ Understanding the seven ways of putting Google on your site ᮣ Getting the search code and putting it on your pages ᮣ Customizing Google search results to match your site ᮣ Building your own Google site T he simplest and most identifiable method of partnering with Google is to incorporate Google searching on your site. You may offer Google search to your visitors free of charge (to them and to you), and you may customize the search to a reasonable degree. Giving your users options to search the Web or your site (or other specific sites) is fairly easy. Google offers four free search services and three paid services: ߜ Google Free. A Google-branded search box that delivers Web results. ߜ Google Free SafeSearch. Same as Google Free, but delivers edited search results free of adult content. ߜ Google Free Web and Site Search. An enhanced version of Google Free with an added option to search only your site or only another site selected by you. ߜ Customized Free Web (and Site) Search. With or without the Site Search option, free customization is available to registered users, enabling them to display search results under their site’s logo and with their site’s colors. ߜ Silver and Gold Search. Two paid search service plans for sites con- ducting millions of searches per year. ߜ Custom Web Search. The highest level of paid search, for extremely high- traffic sites. ISPs and publishers such as EarthLink and the Washington Post are two clients of Custom Web Search. 09_571435 ch05.qxd 5/21/04 11:30 PM Page 83 This chapter describes the free services. See Chapter 15 for information about Google’s premium services. Offering Google searches from your site doesn’t build business in the sense of directly increasing revenue. Any financial benefit derives indirectly from making your site more attractive and useful to your visitors. By the same token, adding a Google search box on your site doesn’t make your site more likely to be crawled (or more thoroughly crawled), and it doesn’t improve your PageRank. However, adding Google Free indirectly enhances your site and makes it more magnetic, if searching is of value to your users. In particular, using Web and Site Search might be the simplest way to offer a search engine for your own content. Terms and Restrictions Most public Web sites are eligible to host a Google search box. Remember, though, that you’re hosting only the search box, not the search results. The box resides on your page, but when visitors launch their searches, they’re taken to Google to see the results. In the uncustomized version of Google Free, the results look just as they do when you start a search from Google, because they are the same. Even fully customized searches are not displayed on your site, even though they’re designed to look as though they are. In using Google Free, you’re giving your visitors an easy way to leave your site. The search results page doesn’t provide a link back to your site, and there’s no way to place such a link. You can, however, force the results page to open in a new browser window, leaving your visitor anchored at your site in the first window. (I explain how later.) Of course, if a visitor restricts the search to your domain (with the Web and Site Search), the search results are filled with links back to your site. Indeed, this scenario is one of the most attractive aspects of using Google Free. Right now you might be thinking, “Ah, well, I’ll strip out the Web search and just offer in-site search.” It’s a clever thought, but you would find the HTML code uncooperative. The Web search option can’t be removed. Despite all these considerations, offering Google search is an attractive option to many sites for many reasons. Nearly all types of sites, from per- sonal to commercial, are eligible. Terms of Service (TOS) do apply to Google Free, but Google doesn’t insist on a digital agreement from you before getting started. The TOS is far less compelling than a Harry Potter book, and to save you the trouble of perusing it, the following items summarize its main points: 84 Part I: Meeting the Other Side of Google 09_571435 ch05.qxd 5/21/04 11:30 PM Page 84 ߜ No frames, mirrors, or cache. Google doesn’t want you appropriating the search process technically or prohibiting the results from being dis- played on a Google-served page. You also are not allowed to capture the results, store them in a database, or otherwise take ownership of them. The ban against mirror sites (replicated site at various locations) is an extension of Google’s identical stricture against them in the Web index. ߜ Monogamy, please. Google is a demanding partner. You may not place another company’s search box on the same page with Google’s. This requirement is widely ignored. ߜ Accept Google, accept its ads. Google displays advertisements on nearly ever search results page, including the ones appearing on your site. That’s because these results aren’t on your pages. So don’t think that you’re going to provide your visitors with an ad-free experience. ߜ Keep it clean. Google doesn’t want to be associated with illegal sites, domains that propagate copyright infringement, adult sites, or sites that sell alcohol or tobacco to minors. ߜ Be nice to Google. Don’t say mean things about the company that’s pro- viding free use of its logo and search engine. ߜ Google doesn’t know you. Don’t pretend that Google is affiliated with or endorses your site’s content. ߜ Obey logo laws. Several bylaws apply to the Google logo. Don’t draw on it, even though Google does. Likewise, don’t take archived logo variations from Google’s site and use them with your search box. Don’t distort the logo by squishing it or stretching it. (You may choose from a selection of sanctioned sizes and colors, though.) Surprisingly, you must not allow Google’s logo to be larger or more prominent than the site logo — Google doesn’t want anyone to mistake your dog-and-pony show for the true, majestic Google site. ߜ Google can cut you off. As with all TOS agreements, the provider (Google in this case) can end this collaboration at any time. The ads Google serves on search pages launched from your site aren’t pub- lished by you, and they’re not AdSense ads. There’s no benefit to you if one of your visitors clicks them, because that person is no longer your visitor. Once that person is off your site, he or she is Google’s visitor, and Google receives the full benefit of ad clickthroughs. Offering Google Free shouldn’t inhibit you from considering becoming an AdSense publisher (as described in Part III). By working both sides of the fence, you get the benefit of users click- ing through ads placed on your pages, while offering visitors the convenience of Googling from your site. 85 Chapter 5: Putting Google Search on Your Site 09_571435 ch05.qxd 5/21/04 11:30 PM Page 85 I strongly suggest that if you add Google Free to your site, you go the whole route with Web and Site Search, fully customized for your site. The ability to search your own domain and present search results in the color scheme of your site (complete with logo) distinguishes Google Free from other ways of initiating a Web search from your site. Without those features, Google Free is a less compelling way of searching than using the Google Toolbar, which offers your visitors one-click searching from your site and any non-Google site. Getting Your Code With a bit of HTML savvy (just the ability to cut, paste, and upload HTML documents to your site’s server), you can be hosting Google searches in min- utes. Registration is not required for basic Google Free, but if you want to customize the search results, Google needs to know who you are and where your domain is. Google Free is installed on your page by means of a small chunk of HTML code. No JavaScript is involved. The snippet is a simple form, comprising the Google logo (which is called from a Google server, not stored on yours), a keyword entry box, a search button, and (in the case of Web and Site Search) radio buttons that toggle between search domains. (See Figure 5-1.) Figure 5-1: Google’s Web and Site Search is free and easy to install. 86 Part I: Meeting the Other Side of Google 09_571435 ch05.qxd 5/21/04 11:30 PM Page 86 1. Go to the search code page here: www.google.com/searchcode.html 2. Scroll down the page to the first code sample, and copy the entire sample to the Clipboard. Highlight the sample with your mouse, and then press Ctrl+C. Figure 5-2 shows the code after it is highlighted. 3. Paste the code into the HTML document representing your Web page. Methods differ widely at this point. You can use any text processor, such as Windows Notepad, to paste the code. Or you can use an HTML text generator, which highlights different types of HTML tags, making the code easier to navigate. Or use the HTML portion of a graphic Web-page editor such as Dreamweaver. However you do it, you need to choose where you want the search box to appear on your page, and position the code to make that happen. 4. Upload the new HTML document for your page to its place on your site server. 5. Visit your page to see the results. Depending on your software, you might be able to view the result before uploading and make adjustments. Figure 5-2: Highlight, copy, and paste Google’s free HTML code to install Google Free search. 87 Chapter 5: Putting Google Search on Your Site 09_571435 ch05.qxd 5/21/04 11:30 PM Page 87 SafeSearch is a Google searching option that blocks Web pages containing explicit sexual content from appearing in search results. To install a SafeSearch box, follow the same steps but in Step 2 scroll further down the code page to the SafeSearch HTML. The search box appears on your page with the Google SafeSearch logo attached (as shown in Figure 5-3). Free Web and Site Search If you choose Web and Site Search, you need to alter the preset HTML code a bit, tailoring it to your Web site. The basic appearance doesn’t change much, but you need to plug in your site’s domain information. Otherwise, Google won’t know how to offer visitors the option of limiting a search to your site. Follow these steps: 1. Go to the search code page: www.google.com/searchcode.html 2. Scroll down the page to the last code sample, and copy the entire sample to the Clipboard. 3. Paste the code into the HTML document representing your Web page. You may paste it anywhere in your HTML document. Google allows the search box to appear anywhere on the page. 4. Change the first two instances of YOUR DOMAIN NAME to your actual domain address, including the http:// prefix. There are three instances of YOUR DOMAIN NAME. In the first two, type your Web address, as in http://www.bradhill.com. (That one’s mine. Type in yours.) 5. Change the third instance of YOUR DOMAIN NAME, to the name you want to appear on your page. In Figure 5-1, note that instead of typing www.digitalsongstream.com, I typed Digital Songstream. I preferred using the name of the site, rather than the address of the site. Type whatever you want your visitors to see. 6. Upload the new HTML document for your page to its place on your site server. Figure 5-3: A Google SafeSearch form. 88 Part I: Meeting the Other Side of Google 09_571435 ch05.qxd 5/21/04 11:30 PM Page 88 You can specify more than one site in which to constrain searches. However, you must always include a search option for the entire Web. In addition to the entire Web and your own site, you may include any other public Web site. I cover multiple domains in the “Customizing Search Results” section of this chapter. Tweaking the search form Before moving on to customizing the search results, you might want to make small changes to the display of the Google search box and the elements sur- rounding it. Doing so requires a bit of HTML familiarity, but some tricks are downright easy. Remember the Terms of Service, summarized previously in the chapter. You may not distort the Google logo, and you may not add dis- paraging comments about Google. Beyond those innocuous guidelines, noth- ing is stopping you from elongating or shortening the search box, stacking the elements vertically instead of horizontally, changing the font type and size, and forcing searches to appear in a new browser window. Stretching and shrinking the search box Google’s code automatically wraps the search button to below the search form if your page doesn’t have enough room for the natural horizontal layout shown in Figure 5-1. You can maintain the horizontal layout in a narrower space by shrinking the search box. In the HTML code, look for this line: <INPUT TYPE=text name=q size=25 maxlength=255 value=””> The size variable determines the horizontal size of the keyword box; a smaller number narrows the entry box. Figure 5-4 shows a keyword box at size 14. Also in Figure 5-4, note that the elements are stacked vertically to fit into a narrow table column. To create this stacking, you use the break tag, br . Placed after a line of code, the break tag forces the next code element below the previous one, instead of next to it. Here is what the modified code looks like. The br tags are in boldface for emphasis: <INPUT TYPE=text name=q size=25 maxlength=255 value=””><br> <INPUT type=submit name=btnG VALUE=”Search”><br> <A HREF=”http://www.google.com/”> <IMG SRC=”http://www.google.com/logos/Logo_40wht.gif” border=”0” ALT=”Google” align=”absmiddle”></A> 89 Chapter 5: Putting Google Search on Your Site 09_571435 ch05.qxd 5/21/04 11:30 PM Page 89 The first line represents the keyword box. The second line is the Search button (the text of which the Webmaster easily changed from Google Search to Search, thereby shrinking the button to a narrower fit). The last three lines refer to the Google logo. Changing typeface and font size As long as you’re getting creative, you should know how easy it is to change the font type and font size of the search options. You can perform this trick only in the Web and Site Search, because it’s the only type of search that has a search-option type to alter. Find the following lines of code: <INPUT type=submit name=btnG VALUE=”Google Search”> <font size=-1> The first line refers to the Google Search button, and I included it just to help you find the second line, which is the one that counts. Looks fairly self- explanatory, doesn’t it? To make a larger font, change the default setting (-1) to 0 or a positive number, using a plus sign before the positive number. Figure 5-5 illustrates an altered version of Figure 5-1, with the font size boosted to +2. Figure 5-4: This Webmaster shrank the keyword box and also stacked the elements. 90 Part I: Meeting the Other Side of Google 09_571435 ch05.qxd 5/21/04 11:30 PM Page 90 Notice that in Figure 5-5 I also changed the typeface from the default (which, on the host page, was Times Roman) to Arial. I did this by adding the face variable to the font tag like this: <font size=-1 face=”arial”> Don’t forget to put quotation marks around the typeface. Forcing results to a new browser window When visitors use your free Google search, they click right out of your site. Providing a convenience shouldn’t necessarily mean that you lose your visi- tors. Forcing the search results to display in a new browser window keeps your site alive in the old browser window. Google encourages this code tweak, and it’s easy to do. You just need to add a target variable with a blank page value to the first line of the code sample. Here’s that line, unaltered: <form method=GET action=”http://www.google.com/search”> Figure 5-5: Eeek! Large font! Probably too large. Experiment with the font tag setting to find the perfect size. 91 Chapter 5: Putting Google Search on Your Site 09_571435 ch05.qxd 5/21/04 11:30 PM Page 91 The blank-page variable is written like this: _blank . Yes, that’s a single under- line followed by the word blank. Precede this with the target command. The whole thing looks like this: <form method=GET action=”http://www.google.com/search” target=_blank> Now when your visitors launch a search, the results pop open in a new window. If you continue to the next section and follow the customization sug- gestions, that new window looks a lot like (but isn’t!) a page on your site. Using a different logo Google offers several stickers from which to choose an official logo. You can see the selection here: http://www.google.com/stickers.html Figures 5-1 and 5-5 both use the 40-percent logo on a white background — that’s the default logo used in all the code samples. To switch logos, follow these steps: 1. Right-click any logo and choose Copy Image Location. 2. In the code sample, find this line: <IMG SRC=”http://www.google.com/logos/Logo_40wht.gif” border=”0” ALT=”Google”> 3. Highlight the location of the image, which is the following part: http://www.google.com/logos/Logo_40wht.gif 4. Paste the copied image location in place of the original. To simplify, you’re copying one image location and pasting it over the previous image location. Make sure the final image location is sur- rounded by quotation marks. 5. Paste the altered code into your Web page. Your server now pulls the correct logo from Google’s server. 6. Upload the new HTML document for your page to its place on your site server. HTML jockeys, go wild Every element of the HTML code sample is up for grabs. Google doesn’t much care how you arrange the elements, as long as you follow these two important guidelines: Don’t distort the logo, and don’t trash Google. 92 Part I: Meeting the Other Side of Google 09_571435 ch05.qxd 5/21/04 11:30 PM Page 92 [...]... 5: Putting Google Search on Your Site Customizing Search Results Satisfyingly, Google encourages you to customize search results pages so that they look (more or less) like your site pages This customization puts your site logo and color scheme on the search result pages To customize, you must register as a Google Free user Google gets you customizing first, and then collects your basic information... Registration is free and painless: 1 Go to the start page: services .google. com/cobrand/free_select 2 Choose the Free WebSearch plus SiteSearch option or the Free WebSearch option In Figure 5-6, I’m choosing WebSearch plus SiteSearch Figure 5-6: Start your customization by choosing a search option and filling in domains to be searched from your page 93 94 Part I: Meeting the Other Side of Google 3 Enter... Building Your Own Google Site The ultimate extension of Google Free is the construction of an entire site dedicated to Google search This ambitious task is best accomplished as a third-party Google interface developer, an avocation Google encourages Google offers software developers a free license to access the Google Web index This license enables alternate Google sites to deliver Google search results... custom Search button, replacing Google s default button You can’t use the Site Search feature as an enterprise solution, tempting though it might be Google searches only public Web sites, not corporate intranets Figure 5-11: A lack of customization results in a rough look 97 98 Part I: Meeting the Other Side of Google Figure 5-12: Nice design integration and a custom Search button, to boot Building Your. .. Interface (API) to query the Google index from their own programs The details of doing so are beyond the scope of this book For more information, go here: http://www .google. com/apis/index.html Chapter 5: Putting Google Search on Your Site On that page, you can download a developer’s kit and Google license key Anyone can get a license key, even those without ambitions to run a Googlelike site Getting a key is... domains are worth searching Figure 5-7: Google reports how many pages of your selected domains reside in the Web index Chapter 5: Putting Google Search on Your Site 5 On the Step 2 of 4 page, scroll down to fill in the customization fields This is where the fun starts The first cluster of settings (see Figure 5-8) relates to your site logo, which can appear at the top of your visitors’ search results... that you want as search options Separate multiple domains with semicolons You are free to offer your visitors searches constrained to any public domain Think about which site searches might benefit your visitors A local news site might offer searches of the New York Times (www.nytimes.com) A search optimization specialist might offer searches of the article database at www seotoday.com Your choice is... customization fields to create a distinctive search results page 95 96 Part I: Meeting the Other Side of Google Figure 5-9: Black logo, gray search table, and a white background It doesn’t work Figure 5-10: A customized search results page, served by Google with the appearance of the original site Chapter 5: Putting Google Search on Your Site The colors you use in customizations can be determined by hexadecimal... seotoday.com Your choice is not etched in stone; you may sign in anytime to change your selections 4 Click the Continue button On the Step 2 of 4 page, Google tells you how many pages of your selected domains currently reside in Google s Web index (See Figure 5-7.) These statistics give you some idea of the depth of the search you’re making available to your visitors Google doesn’t crawl domains you selected... the Google Web API (Application Programming Interface) An API is necessary whenever one program or Web site hooks into a necessary underlying system, such as Google or the Windows operating system If your computer runs Windows, every application program you have uses the Windows API Similarly, every alternate Google interface uses the Google API Entrepreneurial developers can use Google s Application . Chapter 5 Putting Google Search on Your Site In This Chapter ᮣ Understanding the seven ways of putting Google on your site ᮣ Getting the search code and putting. edited search results free of adult content. ߜ Google Free Web and Site Search. An enhanced version of Google Free with an added option to search only your site

Ngày đăng: 24/10/2013, 08:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan