iRSSの日記

はてなダイアリーiRSSの日記の続き

TypePadにGoogleAjaxサーチを埋め込む

マップもいい感じで、埋め込まれている。
地名検索でつかえそう。

Google AJAX Search API in TypePad

Inspired by a blogger named Marjolein Hoekstra, this morning I signed up for a TypePad account so that I could demonstrate how to add Google AJAX Search to a TypePad blog. I got a little carried away and ended up building out a complete TypePad solution. Something that should be pretty easy to migrate into your own TypePad blog. Just follow these instructions:

1. Signup for a Google Ajax Search API Key and capture the key. For my blog, I used a url of http://ajaxsearch.typepad.com
2. Convert your blog templates to "Advanced Template" mode
3. Download ajaxsearch-keys and then create a template named ajaxsearch-keys and populate the template with the contents of this file. Note, this file loads the Maps API as well as the AJAX Search API. Replace the key value with your keys
4. Download ajaxsearch-sidebar and then create a template named ajaxsearch-sidebar and populate the template with the contents of this file
5. Edit sidebar.inc and include the following (where you want the search sidebar to appear)

<$MTInclude module="ajaxsearch-keys"$>
<$MTInclude module="ajaxsearch-sidebar"$>

These instructions assume that you know a little bit about TypePad template editing. The sidebar module I wrote works in the "two column right" module format.

Once you have got this going in your blog, you can do a few cool things:

1. Its very easy to include a hyper link in a blog post that results in a search on the map. Just create a the hyperlink as a javascript url that calls doMapSearch('search-term');. e.g., if you look at the resulting element, in "Edit HTML" mode, it will look something like this: Sakana. Here is an example: Sakana
2. Embedding core center column search is just like map searching only the function is doCoreSearch(); Here is an example: Google
3. Embedding video search links is just like map searching only the function is doVideoSearch(); Here is an example: Jimi Hendrix

Play around with this and let me know what you think. I already know what I think... TypePad Rocks!

p.s. - If you are a Blogger user, check out http://ajaxsearch.blogspot.com