Calculate and show reading time
The reading time displayed in layouts/_default/single.html can now be configured via a reading_speed parameter, instead of always using Hugo’s computed .ReadingTime. (GitHub)
The theme still only shows reading time when
show_reading_time = trueis enabled (page param or section param). (GitHub)The displayed value is now computed like this:
This follows the approach described in Hugo’s
ReadingTimedocumentation, including the multilingual use case. (gohugo.io)
Configuration #
You can set reading_speed globally or per language. In multilingual sites, the recommended approach is language-specific params.reading_speed. (gohugo.io)
[languages]
[languages.en.params]
reading_speed = 228
[languages.de.params]
reading_speed = 179Notes #
- Hugo’s default assumption is 212 words per minute (and 500 for CJK languages) when using
.ReadingTime; settingreading_speedlets you align the displayed value with your own targets per language. (gohugo.io) - PR #801 proposed this feature for language params; the final implementation landed via commit
39e2145(referencing #801) and applies thereading_speedoverride through.Site.Params.reading_speed. (GitHub)