pixelsushirobot/kirby-readingtime
Composer 安装命令:
composer require pixelsushirobot/kirby-readingtime
包简介
Estimates the reading time for any Kirby text field. Modernized for Kirby 3/4/5.
README 文档
README
Estimates the reading time for any Kirby text field. A modernized fork of the archived getkirby-v2/readingtime-plugin, rewritten for the Kirby 3/4/5 plugin API.
What's different from the original
- Registered via the modern
Kirby::plugin()/fieldMethodsAPI (works on Kirby 3, 4 and 5). - Configurable words-per-minute via a plugin option (default
200). - KirbyText-aware word count: text is parsed and tag-stripped before counting, so Markdown/KirbyTag syntax isn't counted as words.
- Ships with
composer.jsonand a version constant.
Installation
Manual
Copy the readingtime folder into /site/plugins.
Composer
composer require pixelsushirobot/kirby-readingtime
Usage
<?= $page->text()->readingtime() ?>
Outputs e.g. 4 minute read, or 35 second read for sub-minute content.
Configuration
Set a global words-per-minute in site/config/config.php:
return [ 'pixelsushirobot.readingtime.wpm' => 240 ];
Or override per call, along with labels and format:
<?= $page->text()->readingtime([ 'wpm' => 180, 'minute' => 'Minute', 'minutes' => 'Minuten', 'second' => 'Sekunde', 'seconds' => 'Sekunden', 'format' => '{minutesCount} {minutesLabel} – {secondsCount} {secondsLabel}' ]) ?>
Options
| Option | Default | Description |
|---|---|---|
wpm |
200 |
Words read per minute |
minute / minutes |
minute |
Singular / plural minute label |
second / seconds |
second |
Singular / plural second label |
format |
{minutesCount} {minutesLabel} read |
Output format |
format.alt |
{secondsCount} {secondsLabel} read |
Format used when under one minute |
format.alt.enable |
true |
Use the alt format for sub-minute content |
Credits
Original author: Roy Lodder. Contributor: Bastian Allgeier.
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-12