Switching from Tapir to ghostHunter

Over the past few months I've noticed Tapir has gotten become broken, completely trashing the ability for anyone to perform a search on my blog. I started to look into alternatives so I could keep search an integral part of my blog. Low and behold I came across ghostHunter at the suggestion of an online acquaintance.

GhostHunter works much the same way as Temacotta's Tapirius does. Through the use of carefully placed js files and code, search is back on my site and a bit more flexible as before. Here's how I was able to integrate it in less than 10 minutes.

First, download the necessary files from the GitHub repository. Delete out the existing Tapirius files from your current Ghost theme for those in the download. Next, you'll want to edit your theme's default.hbs file with the following line of code as the first script in the {{ghost_foot}} section:

<script type="text/javascript" src="{{asset "js/ghostHunter.min.js"}}"></script>  

Next, check your search box code to ensure it matches the format specified by ghostHunter. The code itself should be pretty standard, so not much to change here. My code was in the /partials/menu.hbs file.

<form class="site-search">  
    <input id="search" type="search" class="search-box"></form>  
    <div id="search-results" class="search-results"></div> 

The last step is to enter the search code that does heavy lifting. This is done in your theme's main index.js file, found in /assets/js. When editing the code, keep in mind there are specific parameters you can use with ghostHunter depending on the features you'd like to use. For example, you can include search as-you-type (similar to how Google works), or include a manual clear results button. You may notice I went with the as-you-type search feature on my blog. The code I used for this is:

      results: "#search-results",
      zeroResultsInfo : false,
      info_template   : "<p>Number of posts found: {{amount}}</p>",
      onKeyUp         : true

After all these changes, remember to restart your Ghost application with a quick service ghost restart to have the new code take effect. If everything went according to plan, you should now be using ghostHunter to power your site search.

After everything was said and done, it was pretty smooth transition for me and I really love that the search results change while you're typing. If you're looking for a good alternative to Tapir, I suggest you check out ghostHunter for your site search needs.