Statamic has a similar function incorporated in its core since 2018. Check the docs to see how to use it!
"ReadingTime" was a Statamic plugin that displays the — D'oh! — estimated reading time of an article or page, e.g. 1 min read
, 6 minutes
, 4 minutes, 12 seconds
, or just the number.
- Download the zip file and unzip it (or clone the repo) into
/_add-ons/
. - Ensure that the folder name is
readingtime
and thatpi.readingtime.php
is in it.
- Insert following code in your template file where you want to display the estimated time:
{{ readingtime content="{ content }" }}
- Be happy.
Words per Minute
- For example:
wpm="300"
will set the words per minute to 300 - defining no wpm will default to 200
Format
format="alpha"
will output an English sentence of the time (which can be further extended by the 'styles' parameter)format="numeric"
will an output a digital timer-esque string (4:30 read)
Styles
style="minimal"
will return just the numberstyle="medium"
will returnX min read
style="extended"
will returnX minute(s), X second(s)
- defining no style will default to
X minute(s)
Custom
- Allows you to put in a custom string of text. Simply place a '#' wherever you want the time to be.
custom="# minute read, you jabroni"
will return: '4:30 minute read, you jabroni'
- According to Wikipedia an average person reads prose text at 250 words per minute (wpm) on paper and at 180 wpm on screen, so I chose 200 as a default. See Options to change this setting.
- The script is primarily intended for my personal use and is provided "as is". I have no plans of making updates on a regular basis. There's no warranty expressed or implied. Use it at your own risk.
- I saw this little feature recently on Medium and thought this would be perfect as my first add-on for Statamic. If you have suggestions, corrections, or just want to say hello, please feel free to drop me a line on Twitter (@gimesi).