Add optional reading time to single _layout

This commit is contained in:
Michael Rose
2016-03-21 21:42:55 -04:00
parent c7ebe1d4b3
commit bf4bf6ed82
10 changed files with 79 additions and 24 deletions

9
_includes/read-time.html Normal file
View File

@ -0,0 +1,9 @@
{% assign words = page.content | strip_html | number_of_words %}
{% if words < 180 %}
{{ site.data.ui-text[site.locale].less_than }} 1 {{ site.data.ui-text[site.locale].minute_read }}
{% elsif words < 360 %}
1 {{ site.data.ui-text[site.locale].minute_read }}
{% else %}
{{ words | divided_by:site.words_per_minute }} {{ site.data.ui-text[site.locale].minutes_read }}
{% endif %}