cover

2 February 2025

Accurate Reading Time Estimates

1m58s
golang
blog-post
webdev
time

The problem

I wanted my blog at bylazar.com to offer a smooth experience, so I added a reading time estimate. This simple feature, inspired by Medium, helps readers decide if they have time for a post.

Why Reading Time?

When writing long technical posts, I noticed how helpful a reading time estimate could be. Instead of making readers guess, the estimate helps them plan their time, especially when the content is dense with code snippets and images.

Simple Methods for Reading Time

The usual approach is to calculate reading time based on word count—around 200-250 words per minute. But technical posts often include images and code that slow readers down. So, I wanted something more refined.

A Smarter Approach

After considering the various options, I wanted a more sophisticated approach that could handle the nuances of technical blog posts better. I decided to create a more advanced method for calculating reading time, which factors in:

- Number of words: This is the traditional method, and still a major factor in determining reading time.

- Number of images: Images can slow down reading time, especially when they require careful attention or have detailed captions.

- Number of lines of code: For a blog focused on coding, the number of lines of code can also significantly affect how long a reader will spend on a post.

The Golang Package

To automate this process, I built a Golang package called reading-time, which combines these three factors into a single reading time estimate. It’s simple yet effective, and helps blog authors give a realistic estimate of how long a post will take to read.

How Was It Built

To share this tool with others, I documented the whole process of creating a Golang package on my blog. You can check out the guide here, where I explain the steps I took to create the package, how to publish it to pkg.go.dev, and some useful tips for building and distributing Go packages.

Useful Links

1. Reading-Time package on GitHub

2. Reading-Time package on pkg.go.dev

Conclusion

Using a reading time estimate makes content more accessible. Whether you’re writing about coding, design, or any complex topic, I recommend considering a more detailed method. The reading-time package I built makes this easy to implement.

Whether you use a simple word-based estimate or a more advanced approach like mine, providing a reading time estimate is a simple yet effective way to enhance your readers’ experience and make your content more accessible.