diff --git a/config.toml b/config.toml index 9fe31bfe..a1ff9596 100644 --- a/config.toml +++ b/config.toml @@ -186,6 +186,7 @@ stylesheets = [] copy_button = true # Show the reading time of a page. +# Can also be enabled or disabled on individual pages in the front matter's [extra]. show_reading_time = true # Adds backlinks to footnotes (loads ~500 bytes of JavaScripts). diff --git a/templates/macros/content.html b/templates/macros/content.html index b7bb86d7..86775bd9 100644 --- a/templates/macros/content.html +++ b/templates/macros/content.html @@ -14,11 +14,12 @@ {% endif %} {% if page.date %} -
  • {{ macros_format_date::format_date(date=page.date, short=true) }} {{ separator }}
  • +
  • {{ macros_format_date::format_date(date=page.date, short=true) }}
  • {% 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 %}
  • + {# page settings override config settings #} + {% if page.extra.show_reading_time | default(value="") == true or page.extra.show_reading_time | default(value="") != false and config.extra.show_reading_time | default(value=true) %} + {{ separator }}
  • {{ 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 %} diff --git a/theme.toml b/theme.toml index e4d0ae9a..02c1d4d0 100644 --- a/theme.toml +++ b/theme.toml @@ -70,6 +70,10 @@ stylesheets = [] # Add a "copy" button to codeblocks (loads ~700 bytes of JavaScript). copy_button = true +# Show the reading time of a page. +# Can also be enabled or disabled on individual pages in the front matter's [extra]. +show_reading_time = true + # Adds backlinks to footnotes (loads ~500 bytes of JavaScripts). footnote_backlinks = false