@plugdash/readtime
The EmDash alternative to Reading Time WP
Tell readers what they're committing to.
Estimates reading time from your post's word count and shows it wherever you want. Works on every published post, automatically. Nothing to configure to ship something good.
5min read 5min read 5min read 5min read
This is the default. No configuration.
Setup
-
Install and register
npm install @plugdash/readtimeimport readtime from "@plugdash/readtime" // in emdash plugins array: readtime({ collections: ["blog"] }) -
Add to your layout
import ReadingTime from "@plugdash/readtime/ReadingTime.astro" <ReadingTime post={post} />
After this, every published post shows reading time. If a post doesn't have it yet, publish it again - readtime runs on every publish.
It looks right. But it's yours to change.
Props
| prop | type | default | description |
|---|---|---|---|
post | EmDash content item | Required - the post | |
variant | "badge" | "pill" | "inline" | "minimal" | "badge" | Visual style |
size | "sm" | "md" | "lg" | "md" | Size scale |
label | string | "min read" | Text after the number |
showWords | boolean | false | Also show word count |
CSS custom properties
| token | description |
|---|---|
--plugdash-rt-color | Text colour |
--plugdash-rt-size | Font size |
--plugdash-rt-bg | Background (badge/pill only) |
--plugdash-rt-border | Border colour (badge only) |
--plugdash-rt-radius | Border radius (badge/pill) |
--plugdash-rt-padding | Padding (badge/pill) |
Components are intentionally simple. Copy src/ReadingTime.astro
into your theme and modify freely - no upstream coupling.
Pairs well with
readers who finish a post are your most likely to share or heart it. Show them the path.