Eleventy.js Word Stats Plugin

Reading Time + Word Count for 11ty

git npm

This plugin provides a lightweight wrapper for making available reading-time to the Eleventy Static Site Generator.


npm i @photogabble/eleventy-plugin-word-stats


interface Options {
output?: (stats: ReadTimeResults) => string;
wordBound?: (char: string) => boolean;
wordsPerMinute?: number;

Output function

The function that controls the wordStats filter output is provided an object that matches the following interface:

interface ReadTimeResults {
text: string;
time: number;
words: number;
minutes: number;


In your Eleventy config file (defaults to .eleventy.js):

module.exports = (eleventyConfig) => {

Now the wordStats filter will be available to use in your templates. For example with Nunjuck it can be used as such:

<p>{{ content | wordStats }}</p>

Which will by default output along the lines of:

<p>1244 words, 6 min read</p>

Not invented here

If all you need is the word count formatted, there are two very good alternatives to this plugin:


This 11ty plugin is open-sourced software licensed under the MIT License

Page History

This page was first added to the repository on March 1, 2023 in commit e5f5b5bd and has since been amended 4 times. View the source on GitHub.

  1. refactor(#304): move files into src folder
  2. refactor: sub_title -> subTitle
  3. chore: update heading order
  4. feat: add content for 11ty.js word-stats plugin
  5. chore: add stub project pages