Fred
April 23, 2019, 12:48am
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.
I want to ,like, double or triple the standard reading time.
Where can I do it?
Themes: Casper
Best Regards,
Fred
naz
April 23, 2019, 7:21am
2
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
Fred
April 23, 2019, 8:07am
3
Hi @naz ,
Thanks. I just reduced it.
Best Regards,
Fred
1 Like
Fred
April 24, 2019, 8:33am
4
Hi @naz
How should I maintain this customization?
This will be overridden after ghost update.
Best Regards,
Fred
1 Like
naz
April 25, 2019, 8:35am
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 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.
Fred
April 26, 2019, 12:43am
7
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.
new change:
wordsPerMinute = _.isNaN(_.parseInt(options.hash.words,10)) ? 275 : parseInt(options.hash.words, 10),
Best Regards,
Fred
Fred
April 26, 2019, 12:48am
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