03 Mar 2009
Site search is one of the most important missing features when moving your blog off of a blog engine to a static site. I’m using Jekyll to churn out the pages for this site, but wanted back my missing search.
This post brought to you courtesy of the Google Search AJAX API…
As it turns out, I need only to drop in the AJAX powered Google search and it just works. Here’s how.
- First, head on over to Google Code and get an API key.
- Then, make yourself an include file named google_ajax_search.html (create the _includes directory in the root of your Jekyll project if you don’t have one).
- Next, add this code to the file you just created and substitute your api key and url:
- Now, create a div in your layout, with id=“search” where you’d like the search box to appear.
- Lastly, include your google_ajax_search in the <head> of your layout.