Consistent wording for reading time
This commit is contained in:
parent
f1adcf3918
commit
e907040232
|
@ -12,14 +12,10 @@
|
||||||
{% assign reading_wpm = 200 %}
|
{% assign reading_wpm = 200 %}
|
||||||
{% assign word_count = page.content | split: " " | size %}
|
{% assign word_count = page.content | split: " " | size %}
|
||||||
{% assign reading_time = word_count | divided_by: 200 %}
|
{% assign reading_time = word_count | divided_by: 200 %}
|
||||||
{% case reading_time %}
|
{% if reading_time < 1%}
|
||||||
{% when 0 %}
|
{% assign reading_time = 1 %}
|
||||||
{% assign phrase = "less than a minute." %}
|
{% endif %}
|
||||||
{% when 1 %}
|
|
||||||
{% assign phrase = "about a minute." %}
|
|
||||||
{% else %}
|
|
||||||
{% assign phrase = " minute read" | prepend: reading_time %}
|
{% assign phrase = " minute read" | prepend: reading_time %}
|
||||||
{% endcase %}
|
|
||||||
|
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<time pubdate="pubdate">{{ page.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>
|
<time pubdate="pubdate">{{ page.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>
|
||||||
|
|
10
index.liquid
10
index.liquid
|
@ -13,14 +13,10 @@ data:
|
||||||
{% assign reading_wpm = 200 %}
|
{% assign reading_wpm = 200 %}
|
||||||
{% assign word_count = post.content | split: " " | size %}
|
{% assign word_count = post.content | split: " " | size %}
|
||||||
{% assign reading_time = word_count | divided_by: 200 %}
|
{% assign reading_time = word_count | divided_by: 200 %}
|
||||||
{% case reading_time %}
|
{% if reading_time < 1%}
|
||||||
{% when 0 %}
|
{% assign reading_time = 1 %}
|
||||||
{% assign phrase = "less than a minute." %}
|
{% endif %}
|
||||||
{% when 1 %}
|
|
||||||
{% assign phrase = "about a minute." %}
|
|
||||||
{% else %}
|
|
||||||
{% assign phrase = " minute read" | prepend: reading_time %}
|
{% assign phrase = " minute read" | prepend: reading_time %}
|
||||||
{% endcase %}
|
|
||||||
<time pubdate="pubdate">{{ post.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>
|
<time pubdate="pubdate">{{ post.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>
|
||||||
|
|
||||||
{% if post.data and post.data.tags -%}
|
{% if post.data and post.data.tags -%}
|
||||||
|
|
Loading…
Reference in a new issue