How to increase Reading Time

Hi experts,

Standard “read time” provided by ghost is a bit shorter than the real reading time.
May be because the posts are not in English. :slight_smile:

I want to ,like, double or triple the standard reading time.
Where can I do it?

Themes: Casper

Best Regards,
Fred

Hey @Fred! The reading time is calculated based on hardcoded value of 275 words per minute and can be found here - Ghost/reading_time.js at 62f5bdac4cd9bca12150ec75b897990d7b6072be · TryGhost/Ghost · GitHub.

This value is not configurable at the moment. The only way you can modify it, is by directly changing the source code of your Ghost instance (you’d need to modify the value in reading_time helper.js to whichever you think suits to your language best and restart Ghost instance).

2 Likes

Hi @naz ,

Thanks. I just reduced it. :slight_smile:

Best Regards,
Fred

1 Like

Hi @naz

How should I maintain this customization?
This will be overridden after ghost update.

Best Regards,
Fred

1 Like

Hey @Fred. This parameter could actually be made configurable on helper level. You’d need to modify helpers source code to receive the wordsPerMinute as a parameter, then it would be super easy to maintain :wink: Would love to assist you reviewing a PR to Ghost for such change!

@Fred to what degree have you changed it and for what Language exactly?!

I am asking because at some point in the near future I might be wondering around on the same Trail. :wink:

Hi @naz

I just changed the helper reading_time.js as you suggested.
I will do a PR. It is my first time to do a PR though. :slight_smile:

new change:
wordsPerMinute = _.isNaN(_.parseInt(options.hash.words,10)) ? 275 : parseInt(options.hash.words, 10),

Best Regards,
Fred

@KranzKrone

The change is not related to Language actually.
You just guess the time taken for the words of your language and use in the post-cards.hbs.

reading_time.js
wordsPerMinute = _.isNaN(_.parseInt(options.hash.words,10)) ? 275 : parseInt(options.hash.words, 10),

You can then use in post-cards.hbs like below.
<span class="reading-time">{{reading_time words="20"}}</span>

Best Regards,
Fred

1 Like