jekyll

Implementing search as a jekyll plugin

Search for most dynamically-generated websites is usually implemented as a server-side feature. The server generates and maintains an index of all unique words and their occurrences on the site. When a client runs a search query, the query is sent to the server which then looks up the query in its index and returns a list of results, which are then rendered on the client. An approach like this is clearly infeasible on static websites such as those generated using a static site generator like Jekyll, so one has to come up with alternative solutions.

Compressing content for GitHub pages

Still chugging along with my implementation of client-side search for a statically-generated Jekyll site with bloom filters. Currently, the collected JSON that contains individual bloom filters for each blog post clocks in at just over 28k for around 80 posts. I decided to try to cut that down even further by compressing the JSON before sending it to the client. With the gzip module that comes with ruby, I cut the size down by more than half, but then I ran into a brick wall: setting the Content-Encoding flag in the headers for that file.

Access hashmap elements in liquid template

The search plugin that I’m writing for Jekyll with bloom filters is coming along swimmingly. I still haven’t thought of a convenient way of using it with Github pages since Github runs all Jekyll-powered sites with the safe: true configuration option, but I’ll cross that bridge when I come to it. In the meantime, I’m generating one bloom filter per blog post and putting all the filters into a /search.json page that will be filled up by my plugin.

The new theme is ready

My flatmate Ninad told me about a cool theme named Cait for Pelican a couple of weeks back, and I immediately decided to implement something similar for this site. As outlined in a previous post I was having some trouble getting the theme to work as intended on pinch-to-zoom-enabled mobile devices, but I sorted those issues out with a small hack. The last thing remaining was getting the Archives page to render differently on mobile devices, since the 3-column format I’ve chosen for larger displays isn’t really well-suited for screen-estate-limited displays.

Cosmetic update to the site

I spent a few days working on this site, moving a few items around and changing the content of the index page and the sidebar. It’s still not quite where I’d like it to be, but I’m happy with it for now. Next up will be add a few more of my github repos to the sidebar, and hosting those repos on heroku instances. My dedicated EC2 instance which used to host this site and several node.

Bloom filters

As promised in my previous post, I spent some time today understanding Bloom filters. While [the wiki page]((http://en.wikipedia.org/wiki/Bloom_filter) intimidated me a bit when I first looked at it, it’s actually pretty simple once you sit down and patiently read through the whole thing. Bloom filters are a lot like hash maps, except that they save a lot on the space occupied for maintaining an index of your data at the cost of a minor chance of false positives.