Automatically Calculate and Display Blog Post Reading TimeAutomatically Calculate and Display Blog Post Reading Time
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
"4 min read" is one small line that tells a visitor whether to start now or save the post for later.
• The script counts the words in the post's rich text element.
• It divides by about 200 words a minute and rounds to at least one minute.
• The result is written into any element with the data-read-time attribute.
• It lives in the blog post template's custom code, so every post gets it and it updates when the post changes.
Do you show reading time on your blog?
Follow for more videos: instagram.com/sellwrightstudio · youtube.com/@sellwrightstudio
Senad's avatar
Small detail, but read time really helps on blog posts. Counting the words straight from the rich text element means editors never have to touch it, which is the best part.
Raja's avatar
Thanks Senad, that was the whole goal: editors write the post and the read time just follows. It also stays right when they go back and edit an old post, so no stale "4 min" sitting on a piece that grew to ten.
Senad's avatar
Simple and useful. Living in the blog template's custom code with a data-read-time attribute means editors never have to think about it.
Raja's avatar
That was the idea. The attribute also keeps it flexible: the designer can move the read-time line anywhere in the template, or style it differently, and the script still finds it.
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started