Cyrus Stoller home about consulting

Adding related posts to a Jekyll blog

I use Jekyll to generate this blog as static files. The lsi configuration produces an index of related posts instead of just the most recent ones that are rendered at the bottom of each post.

# _config.yml
lsi: true

With only a few posts, this worked fine out of the box. But recently, I started having second thoughts about whether I wanted to run a local server because I was unsure whether it was hanging and as a result I found myself using CTRL-C more than usual. To fix this, I needed the classifier-reborn gem to take advantage of GNU gsl, which appeared in warning messages when I started the WEBrick server.

Notice: for 10x faster LSI support, please install http://rb-gsl.rubyforge.org/

Unfortunately, the instructions on http://rb-gsl.rubyforge.org/ didn’t direcly tie back to my Jekyll project, so I had just ignored them. In hindsight, I should have paid more attention to a potential 10x performance improvement.

Setup

Getting gsl working on my Mac took me a little longer than expected, so I wanted to share some quick tips, so you can avoid the same confusion.

$ brew install gsl

And then add the following gems to your Gemfile:

gem "gsl"
gem "narray" # This is the gem that I didn't know about

After adding this, the indexing is basically instantenous.

Hope this can help you stay focused on your writing.

Category Tutorial