jekyll-smart-reading-time

Smart reading time estimation for Jekyll — strips code blocks before counting.

Gem Version

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.

Why not the others?

Gem Last release Strips code?
jekyll-smart-reading-time (this gem) 2025 ✅ Yes
jekyll-timetoread 2014 ❌ No
reading_time 2013 ❌ No

Installation

Add to your site's Gemfile:

gem "jekyll-smart-reading-time"

Then add to _config.yml:

plugins:
  - jekyll-smart-reading-time

Run:

bundle install

Usage

The gem automatically injects page.reading_time into every post and page:

{{ page.reading_time }} min read

Example in a post layout:

<span class="reading-time">{{ page.reading_time }} min read</span>

Liquid tag

You can also use the {% reading_time %} tag, which renders "X min read" directly:

{% reading_time %}

Configuration

Override the default 238 WPM in _config.yml:

reading_time:
  wpm: 200

The default of 238 WPM is drawn from research on average adult reading speed.

What gets stripped

Before counting words, the following are removed:

  1. YAML frontmatter (--- blocks)
  2. Fenced code blocks (``` ... ```)
  3. Indented code blocks (lines starting with 4+ spaces or a tab)
  4. HTML tags (<...>)
  5. Liquid tags ({{ ... }} and {% ... %})

License

MIT © 2025 Jason Chance