From 39e2145985954eac07dd343a456f5696c8f9e9d6 Mon Sep 17 00:00:00 2001
From: Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
Date: Mon, 29 Sep 2025 02:49:18 +0000
Subject: [PATCH] theme(fix): add configurability to reading time display
---
layouts/_default/single.html | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index b89aea6..7bb3f16 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -46,7 +46,13 @@
3) A page front matter value is set `show_reading_time = true`
*/}}
{{ if (or (compare.Eq (.Param "show_reading_time") true) (compare.Eq $section.Params.show_reading_time true) )}}
- <span class="f6 mv4 dib tracked"> - {{ lang.Translate "readingTime" .ReadingTime }} </span>
+ {{ $readingTime := .ReadingTime }}
+ {{ with .Site.Params.reading_speed }}
+ {{ $readingTime = div (float $.WordCount) . }}
+ {{ $readingTime = math.Ceil $readingTime }}
+ {{ $readingTime = int $readingTime }}
+ {{ end }}
+ <span class="f6 mv4 dib tracked"> - {{ lang.Translate "readingTime" $readingTime }} </span>
<span class="f6 mv4 dib tracked"> - {{ lang.Translate "wordCount" .WordCount }} </span>
{{ end }}
</header>
--
Gitblit v1.10.0