A Jekyll plugin to how long a post will take to read
Having set about creating a Jekyll site i quickly realised whilst playing with the css that i wanted to copy Medium’s “4 min read” system. Knowing how long an article helps me to make a really quick decision about whether i’m going to read the content during the day at work or if i’m going to Instapaper it for later consumption.
My first Jekyll plugin
So i set about creating the code required to do this. jekyll plugins were my answer. There are a lot of Jekyll plugins out there and i’m guessing a lot of people have already accomplished what i wanted to achieve but i wanted to get my hands dirty and have a play.
15 minutes later, i’ve got my plugin. Ellen Gummesson had largely completed the task i wanted to achieve but without the final 10% that i was after, so i forked her repo and made the changes.
I am now left with a Liquid tag that i can use like so…
{{ page.content | reading_length }}
You can checkout my fork of the plugin over on Github.
To be as explicit as possible, here is the code to drop into your _plugins
folder.