1
Fork 0

Consistent wording for reading time

This commit is contained in:
Jan-Erik Rediger 2022-01-30 00:52:57 +01:00
parent f1adcf3918
commit e907040232
2 changed files with 8 additions and 16 deletions

View file

@ -12,14 +12,10 @@
{% assign reading_wpm = 200 %}
{% assign word_count = page.content | split: " " | size %}
{% assign reading_time = word_count | divided_by: 200 %}
{% case reading_time %}
{% when 0 %}
{% assign phrase = "less than a minute." %}
{% when 1 %}
{% assign phrase = "about a minute." %}
{% else %}
{% if reading_time < 1%}
{% assign reading_time = 1 %}
{% endif %}
{% assign phrase = " minute read" | prepend: reading_time %}
{% endcase %}
<div class="metadata">
<time pubdate="pubdate">{{ page.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>

View file

@ -13,14 +13,10 @@ data:
{% assign reading_wpm = 200 %}
{% assign word_count = post.content | split: " " | size %}
{% assign reading_time = word_count | divided_by: 200 %}
{% case reading_time %}
{% when 0 %}
{% assign phrase = "less than a minute." %}
{% when 1 %}
{% assign phrase = "about a minute." %}
{% else %}
{% if reading_time < 1%}
{% assign reading_time = 1 %}
{% endif %}
{% assign phrase = " minute read" | prepend: reading_time %}
{% endcase %}
<time pubdate="pubdate">{{ post.published_date | date: "%b %d, %Y" }} · {{ phrase }}</time>
{% if post.data and post.data.tags -%}