athityakumar.github.io
athityakumar.github.io copied to clipboard
Add "X minutes read" stamp
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