How to increase Reading Time

#1

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

#2

Hey @Fred! The reading time is calculated based on hardcoded value of 275 words per minute and can be found here - https://github.com/TryGhost/Ghost/blob/62f5bda/core/server/helpers/reading_time.js#L25.

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
#3

Hi @gargol ,

Thanks. I just reduced it. :slight_smile:

Best Regards,
Fred

1 Like
#4

Hi @gargol

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

Best Regards,
Fred

1 Like
#5

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!

#6

@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:

#7

Hi @gargol

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

#8

@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