Display estimated reading time using Bengal'sreading_timefilter.
The Pattern
1 2 3 | |
That's it. Bengal'sreading_timefilter calculates based on word count (200 wpm default).
What's Happening
| Component | Purpose |
|---|---|
page.content |
Raw content of the page |
reading_time |
Bengal filter: counts words, divides by 200 |
Variations
With Word Count
Bengal provides aword_countfilter that strips HTML and counts words:
<span>{{ page.content | word_count }} words · {{ page.content | reading_time }} min read</span>
Both filters work together seamlessly since they use the same word counting logic.
Custom Calculation
1 2 3 4 5 | |
Handle Short Content
1 2 3 4 5 6 7 8 9 10 11 | |
Frontmatter Override
Allow manual override for complex content:
1 2 3 4 5 | |
Then in frontmatter:
1 2 3 4 | |
Seealso
- Template Functions — All filters
- List Recent Posts — Include reading time in post lists