From 497fe9d1278b9a71528c04b5da33ac8fbfd387ca Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Wed, 30 Aug 2023 19:57:16 +0100 Subject: [PATCH] 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 @@
  • {{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}
  • {% endif %} -
  •  {{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}
  • + {% if page.extra.show_reading_time %} +
  •  {{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}
  • + {% endif %} {% if page.taxonomies and page.taxonomies.tags %}
  •  {{ separator }} {%- if lang != config.default_language -%}{{ trans(key="tags" | safe, lang=lang) | capitalize }}{% else %}Tags{%- endif -%}: 
  • --- config.toml | 3 +++ templates/macros/content.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config.toml b/config.toml index d1885fed..9fe31bfe 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 b232e6c9..b7bb86d7 100644 --- a/templates/macros/content.html +++ b/templates/macros/content.html @@ -17,7 +17,7 @@
  • {{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}
  • {% endif %} - {% if !page.extra.skip_readtime %} + {% if page.extra.show_reading_time %}
  •  {{ page.reading_time }}{%- if lang != config.default_language %} {{ trans(key="min_read" | safe, lang=lang) }} {% else %} min read {% endif %}
  • {% endif %}