From 857633572e818b0113d5d4ba88b865c541b377bf Mon Sep 17 00:00:00 2001 From: D14rn <49399494+D14rn@users.noreply.github.com> Date: Sat, 23 Nov 2024 22:17:13 +0100 Subject: [PATCH] Support reading_speed language param in single.html Signed-off-by: D14rn <49399494+D14rn@users.noreply.github.com> --- layouts/_default/single.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b91f134..290611c 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -43,7 +43,14 @@ 3) A page front matter value is set `show_reading_time = true` */}} {{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}} - - {{ i18n "readingTime" .ReadingTime }} + {{ $readingTime := .ReadingTime }} + + {{ with .Site.Params.reading_speed }} + {{ $readingTime = div (float $.WordCount) . }} + {{ $readingTime = math.Ceil $readingTime }} + {{ end }} + + - {{ i18n "readingTime" (int $readingTime) }} - {{ i18n "wordCount" .WordCount }} {{ end }}