Fix for division by 0 error caused by null words_per_minute

This commit is contained in:
Sergio C. Orozco Torres
2016-06-07 11:38:34 -04:00
committed by Michael Rose
parent 3ed08304ea
commit 083ab747e1
2 changed files with 43 additions and 5 deletions
+9 -5
View File
@@ -4,10 +4,14 @@
{% assign words = page.content | strip_html | number_of_words %}
{% endif %}
{% 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 }}
{% if site.words_per_minute %}
{% 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 %}
{% else %}
{{ words | divided_by:site.words_per_minute }} {{ site.data.ui-text[site.locale].minutes_read }}
{{ site.data.ui-text[site.locale].undefined_words_per_minute }}
{% endif %}