Add Search to Ghost using Swiftype
- Head to swiftype.com and type your URL into the screen shown.
- Create an account if you don't have one already.
- It will then do a check of your URL and some validation, then ask for you to name the engine. Enter in a name.
- Add in your contact info if you would like.
- Click on "Complete Setup"
Click on "Install Swiftype On Your Website" and it will give you the code you need.
The code is in two chunks, the first is the input where the search will go, and the second is the script needed for it to work.
- In order for swiftype to work, you do have to wait for it to finish crawling your site. It can take a little while. So, while its doing that, lets edit the theme code.
- Open up your theme and go to where you would like the search to be (
default.hbsif you want on every page,
index.hbsif you want on the home page). I am going to use the
index.hbsto put the search on my home page.
- Add the body and the script they give you (its fine to just keep them right by each other) to your theme where you want them to show up. We put it just below the header:
- Once Swiftype is done indexing (we did have to refresh to see when it was done, the button just kept spinning), stop and start Ghost, and then you will see the search on your site!