20100523 google custom search - plembo/onemoretech GitHub Wiki

title: Google custom search link: https://onemoretech.wordpress.com/2010/05/23/google-custom-search/ author: lembobro description: post_id: 155 created: 2010/05/23 10:37:13 created_gmt: 2010/05/23 10:37:13 comment_status: open post_name: google-custom-search status: publish post_type: post

Google custom search

Just added Google Custom Search to this blog, thereby addressing one of the biggest complaints I’ve gotten since the migration to Flatpress. Google Custom Search is a service offered by the web app megagiant for those who don’t have the time, intelligence or self-discipline to craft their own search engine. Because I fit into all three categories, implementing custom search on this site was really a no-brainer.

The Getting Started tutorial is a good place to well, start. Of course I didn’t read it, or any of the other doc, before diving right in. As a result I wasted time I’ll never get back in going down “intuitive” dead ends. This was my fault, not Google’s, and probably the number one reason someone like me would never stand a chance at even getting interviewed by them.

Setting things up on the Google side was extremely easy. To start off you need a Google account. For me this was the same account I use for Gmail and other Google services like Calendar. Once I was logged in I went over to the Google Custom Search front page and the “Create a Custom Search Engine” button. Filling out the form was straightforward, as was the selection of the “edition” to use. There are two: Standard and Google Site Search. Standard is free, and includes Google ads in the margins of the search results pages. Google Site Search is paid, with fees starting at $100 based on the number of site pages. Incredibly the latter does not include those wonderful Google ads.

The quickest option to get things going for me was to simply enter my site’s base address eldapo.lembobrothers.com (sans the “http://”) and then go over to “Look and Feel” to get the code for my search widget. After struggling with other options, I settled on “Google hosted page” as my hosting option and set the style to “Minimalist”. Clicking “Get Code” brought up a window with the HTML I’d need to embed on my site.

For this site the code turned out to be:

<form action="http://www.google.com/cse" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="017549949717252601920:zc81fpu4vgq" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="31" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>

This I took and pasted into a Flatpress static page called “google_search”. After saving it out, this page became visible under “Widgets”, “Block Parser Widgets” in the Administrative Area of my Flatpress site. All I did was click to enable it so it was visible on the Manage Widgets panel (as BlockParser:google_search), and then dragged and dropped it into the appropriate position in the “Right Bar” widget set.

I think one of the challenges in using one of the more customized (or customizable) hosting options available is the operation of the Flatpress prettyurls plugin. Enabling that plugin gave the site more human-friendly, and most importantly, prior search engine result friendly, urls for most articles. It also broke the shipping searchbox plugin on anything more than article subject text searches. Full text searches exploded on delivery.

Copyright 2004-2019 Phil Lembo

⚠️ **GitHub.com Fallback** ⚠️