Use Zola's built-in reading time variable instead of the custom implementation (fixes #102)

This commit is contained in:
daudix
2024-10-12 00:21:16 +03:00
parent d22922f46b
commit a7e1112791
3 changed files with 10 additions and 14 deletions

View File

@ -45,24 +45,18 @@
<h1>{{ page.title }}</h1>
{%- if page.authors or config.extra.show_read_time -%}
{%- if page.authors or config.extra.show_reading_time -%}
<p>
<small>
{%- if page.authors -%}
<span>{% include "partials/authors.html" -%}</span>
{%- if config.extra.show_read_time -%}
{%- if config.extra.show_reading_time -%}
<span></span>
{%- endif -%}
{%- endif -%}
{%- if config.extra.show_read_time -%}
{%- set words = page.content | striptags | safe | wordcount -%}
{%- set words_per_minute = config.extra.words_per_minute | default(value=200) -%}
{%- set number_of_minutes = words / words_per_minute | round -%}
{%- if number_of_minutes == 0 -%}
{%- set number_of_minutes = 1 -%}
{%- endif -%}
<span>{{ macros_translate::translate(key="minutes_read", number=number_of_minutes, default="$NUMBER minute read", language_strings=language_strings) }}</span>
{%- if config.extra.show_reading_time -%}
<span>{{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}</span>
{%- if page.taxonomies -%}
<span></span>
{%- endif -%}