Smart reading time estimation for Jekyll — strips code blocks before counting.
Most existing Jekyll reading-time gems are abandoned and count everything — including hundreds of lines of code samples — as prose. This gem strips fenced code blocks, indented code blocks, HTML tags, and Liquid tags before counting words, so the estimate actually reflects reading time for your content.
| Gem | Last release | Strips code? |
|---|---|---|
jekyll-smart-reading-time (this gem) |
2025 | ✅ Yes |
jekyll-timetoread |
2014 | ❌ No |
reading_time |
2013 | ❌ No |
Add to your site's Gemfile:
gem "jekyll-smart-reading-time"Then add to _config.yml:
plugins:
- jekyll-smart-reading-timeRun:
bundle installThe gem automatically injects page.reading_time into every post and page:
{{ page.reading_time }} min readExample in a post layout:
<span class="reading-time">{{ page.reading_time }} min read</span>You can also use the {% reading_time %} tag, which renders "X min read" directly:
{% reading_time %}Override the default 238 WPM in _config.yml:
reading_time:
wpm: 200The default of 238 WPM is drawn from research on average adult reading speed.
Before counting words, the following are removed:
- YAML frontmatter (
---blocks) - Fenced code blocks (
``` ... ```) - Indented code blocks (lines starting with 4+ spaces or a tab)
- HTML tags (
<...>) - Liquid tags (
{{ ... }}and{% ... %})
MIT © 2025 Jason Chance