Adding search to a static Ghost blog

    Adding search to a static Ghost blog

    When I switched over to Ghost, my new theme didn't have a search function. Due to a combination of popular demand (read: one friend who asked about it) and me running across a plugin to enable searches for Ghost, I decided to do it today.

    It was actually surprisingly simple, taking less than 2 hours, again, with most of the time being spent on CSS.

    I used the SearchinGhost plugin, that does the indexing and searching entirely in the browser. It pretty much works out of the box, I just had to add an API key and I changed some of the templates a bit.

    Normally, the plugin connects to the Ghost API to retrieve all the posts, but it does so via a GET request, so if I save a file in the right folder hierarchy, containing the JSON response, I can get the plugin to work on my statically served site.

    The posts are loaded when clicking in the search bar. It takes a bit, because I have written 1.9Mb of content by now. But after it's sent over the network, searching is blazing fast.

    Happy searching!

    I’m publishing this as part of 100 Days To Offload - Day 8.