Adding Search to Ghost using ghostHunter
Head to the ghostHunter GitHub page and on the right hand side, hit "Download Zip".
Extract the zip file that was downloaded, and put the
jquery.ghostHunter.minfile inside the
assets/jsfolder of the theme you are using.
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.hbsfile, 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:
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.
Once that is added in, you will need to restart Ghost for the change to take effect.
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!
Now that you have added search, check out our next post on how to add a featured post!