How to add mins to read in jekyll post like medium
Edit the _layouts/post.html
and place below lines appropriately.
{% assign words = content | number_of_words %}
{{ words | plus:179 | divided_by:180 }} min read
References
- I got this idea from Carlos Becker’s post
- He has used
if-else
- Whereas I have avoided that using
ceil(words/180)
i.e same as(words+179)/180
{% assign words = content | number_of_words %}
{% if words < 360 %}
1 min
{% else %}
{{ words | divided_by:180 }} mins
{% endif %}
</span>