athityakumar.github.io icon indicating copy to clipboard operation
athityakumar.github.io copied to clipboard

Add "X minutes read" stamp

Open athityakumar opened this issue 8 years ago • 1 comments

athityakumar avatar Feb 21 '17 05:02 athityakumar

Reference: https://help.medium.com/hc/en-us/articles/214991667-Read-time

A simple way to calculate would be:

require 'yaml'
READING_SPEED = 265 # Same as Medium

article = YAML.load(File.read("auto/data/posts/#{post_name}.yml"))
words_count = article["html_content"].count(" ")
x_minutes = words_count/READING_SPEED + 1

athityakumar avatar Jan 14 '19 00:01 athityakumar