popov.link/_includes/reading-time.html

11 lines
360 B
HTML
Raw Normal View History

2024-02-14 10:38:24 +03:00
{%- capture words -%}
{{- content | number_of_words | minus: 180 -}}
{%- endcapture -%}
2024-02-14 02:38:59 +03:00
2024-02-14 13:19:23 +03:00
{%- if words contains '-' -%}
{{- '1 min read' | strip | normalize_whitespace | xml_escape -}}
{%- endif -%}
2024-02-14 10:38:24 +03:00
{%- unless words contains '-' -%}
2024-02-14 13:19:23 +03:00
{{- words | plus: 150 | divided_by: 150 | append: ' min read' | strip | normalize_whitespace | xml_escape -}}
2024-02-14 10:38:24 +03:00
{%- endunless -%}