
jekyll-smart-reading-time
Smart reading time estimation for Jekyll that strips code blocks, HTML, and Liquid tags before counting — unlike the abandoned gems that count everything.
jekyll-smart-reading-time calculates reading time for Jekyll posts the right way. The existing abandoned gem counts every character on the page — including code blocks, HTML tags, and Liquid template syntax. That makes a post heavy on code examples appear to take 20 minutes to read when the actual prose is 3 minutes. This plugin strips all of that noise before counting.
What Gets Stripped
Before counting words, the plugin removes:
- Fenced code blocks (
` ... `) - Indented code blocks (4+ space lines)
- HTML tags
- Liquid tags (
{% %}and{{ }}) - YAML frontmatter
Then it counts remaining words at 238 WPM (research-backed average for adult reading speed) and injects the result — minimum 1 minute — into page.reading_time automatically.
Installation
Add to your Gemfile:
gem "jekyll-smart-reading-time"
Add to plugins: in _config.yml:
plugins:
- jekyll-smart-reading-time
Template Usage
The reading time is available as page.reading_time (an integer) on every post and page automatically:
<span>{{ page.reading_time }} min read</span>
Or use the optional Liquid tag anywhere in content:
{% reading_time %}
Which renders: 3 min read
Configuration
Override the default reading speed:
reading_time:
wpm: 200 # default: 238
Source
Available on GitHub and RubyGems.
gem install jekyll-smart-reading-time

