Reading info

Provide some information about the page content

Options

extensions string[]

File extensions to process

Default:
[ ".md" ]
wordsPerMinute number

The words per minute a reader can read (default: 275)

Default:
275

Description

This plugin creates the readingInfo variable in your pages with some interesting info about the page content, like the time to read or the number of pages.

Installation

Import this plugin in your _config.ts file to use it:

import lume from "lume/mod.ts";
import readingInfo from "lume/plugins/reading_info.ts";

const site = lume();

site.use(readingInfo());

export default site;

Usage

It uses the Intl.Segmenter standard function to count the words, using the page variable lang to detect the language. The data is stored in the variable readingInfo, so you can use it in your templates in this way:

<p>{{ readingInfo.words }} words</p>
<p>{{ readingInfo.minutes }} min read</p>