diff --git a/CHANGELOG.md b/CHANGELOG.md index bda44e7..7b422e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add "DRAFTED" watermark to drafted posts. +### Changed + +- Rename `show_read_time` to `show_reading_time`. +- Use Zola's built-in reading time variable instead of the custom implementation (#102). + ### Fixed - Fix navbar mods having broken border radius. diff --git a/config.toml b/config.toml index 2c20d41..fd3d64c 100644 --- a/config.toml +++ b/config.toml @@ -131,10 +131,7 @@ source_url = "https://codeberg.org/daudix/duckquill" # See https://www.getzola.org/documentation/content/syntax-highlighting/ show_copy_button = true # Whether to show estimated read time in posts. -# Calculated using the simple math: number of words ÷ words per minute. -show_read_time = true -# -# words_per_minute = 200 +show_reading_time = true # # Whether to show a share button in articles. # Uses https://shareopenly.org. diff --git a/templates/article.html b/templates/article.html index 880e6f8..d3f7dc9 100644 --- a/templates/article.html +++ b/templates/article.html @@ -45,24 +45,18 @@
{%- if page.authors -%} {% include "partials/authors.html" -%} - {%- if config.extra.show_read_time -%} + {%- if config.extra.show_reading_time -%} • {%- 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 -%} - {{ macros_translate::translate(key="minutes_read", number=number_of_minutes, default="$NUMBER minute read", language_strings=language_strings) }} + {%- if config.extra.show_reading_time -%} + {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }} {%- if page.taxonomies -%} • {%- endif -%}