Hi,
I was going through Ghost Github source code , I’m curios about how reading_time is calculated .
It might be off the topic, any references to the util function used will be really helpful
thanks
Raj
Hey @RajNandigalla
You can see the reading time logic here:
import countImages from './count-images';
import countWords from './count-words';
export function estimatedReadingTimeInMinutes({wordCount, imageCount}) {
const wordsPerMinute = 275;
const wordsPerSecond = wordsPerMinute / 60;
let readingTimeSeconds = wordCount / wordsPerSecond;
// add 12 seconds for the first image, 11 for the second, etc. limiting at 3
for (var i = 12; i > 12 - imageCount; i -= 1) {
readingTimeSeconds += Math.max(i, 3);
}
let readingTimeMinutes = Math.round(readingTimeSeconds / 60);
return readingTimeMinutes;
}
/**
* Reading minutes method
*
This file has been truncated. show original