popov.link/_includes/reading-time.html

11 lines
360 B
HTML

{%- capture words -%}
{{- content | number_of_words | minus: 180 -}}
{%- endcapture -%}
{%- if words contains '-' -%}
{{- '1 min read' | strip | normalize_whitespace | xml_escape -}}
{%- endif -%}
{%- unless words contains '-' -%}
{{- words | plus: 150 | divided_by: 150 | append: ' min read' | strip | normalize_whitespace | xml_escape -}}
{%- endunless -%}