Adding Search to Ghost using ghostHunter

If you want to add searching to your Ghost blog, Jamal Neufeld has created a easy way for it to be added in. Jamal calls his search ghostHunter. Here is how to get it installed:

  1. Head to the ghostHunter GitHub page and on the right hand side, hit "Download Zip".

    Ghost Add Search

  2. Extract the zip file that was downloaded, and put the jquery.ghostHunter.min file inside the assets/js folder of the theme you are using.

  3. Now we are going to add the code inside of our Ghost theme.
    I am going to put the search bar just under the content on every page. Where this code goes depends largely on your theme and where you want the search bar to show up. I am using the default Casper theme.

    Open up your default.hbs file, and add in the following scripts to where ever your other script includes are in your theme. For Casper, this is at the very bottom of the file:

  4. Once the script is added in, add in the search form for where you want your search bar to be. We are just going to put it at the very bottom of the page to make it easy, but you will probably want to style and place it where it fits in your theme.

  5. Once that is added in, you will need to restart Ghost for the change to take effect.

  6. Now it will show up below your posts! Make a search and it will show you all the posts that have that search in it!

    Ghost Add Search

Now that you have added search, check out our next post on how to add a featured post!