Support hiding the read time indication on pages

diff --git a/config.toml b/config.toml
index d1885fe..9fe31bf 100644
--- a/config.toml
+++ b/config.toml
@@ -185,6 +185,9 @@ stylesheets = []
 # Add a "copy" button to codeblocks (loads ~700 bytes of JavaScript).
 copy_button = true

+# Show the reading time of a page.
+show_reading_time = true
+
 # Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
 footnote_backlinks = false

diff --git a/templates/macros/content.html b/templates/macros/content.html
index 4c42835..b7bb86d 100644
--- a/templates/macros/content.html
+++ b/templates/macros/content.html
@@ -17,7 +17,9 @@
                 <li>{{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}</li>
             {% endif %}

-            <li title="{{ page.word_count }} {%- if lang != config.default_language %} {{ trans(key="words" | safe, lang=lang) }} {% else %} words {% endif %}">&nbsp;{{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}</li>
+            {% if page.extra.show_reading_time %}
+                <li title="{{ page.word_count }} {%- if lang != config.default_language %} {{ trans(key="words" | safe, lang=lang) }} {% else %} words {% endif %}">&nbsp;{{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}</li>
+            {% endif %}

             {% if page.taxonomies and page.taxonomies.tags %}
                 <li>&nbsp;{{ separator }}&nbsp;{%- if lang != config.default_language -%}{{ trans(key="tags" | safe, lang=lang) | capitalize }}{% else %}Tags{%- endif -%}:&nbsp;</li>
This commit is contained in:
Steven Roose 2023-08-30 19:57:16 +01:00
parent cf95506d08
commit 497fe9d127
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
2 changed files with 4 additions and 1 deletions

View file

@ -185,6 +185,9 @@ stylesheets = []
# Add a "copy" button to codeblocks (loads ~700 bytes of JavaScript).
copy_button = true
# Show the reading time of a page.
show_reading_time = true
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
footnote_backlinks = false

View file

@ -17,7 +17,7 @@
<li>{{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}</li>
{% endif %}
{% if !page.extra.skip_readtime %}
{% if page.extra.show_reading_time %}
<li title="{{ page.word_count }} {%- if lang != config.default_language %} {{ trans(key="words" | safe, lang=lang) }} {% else %} words {% endif %}">&nbsp;{{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}</li>
{% endif %}