From 90bf9c855324e63cd7d7b0c9fd5aae36958b94ca Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 5 Sep 2024 17:40:40 +0800 Subject: [PATCH] fix readingTime --- layouts/posts/single.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/posts/single.html b/layouts/posts/single.html index cdca12136..46a7cbbac 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -96,7 +96,9 @@

{{ . }}

{{ partial "plugin/fontawesome.html" (dict "Style" "solid" "Icon" "pencil-alt") }} {{ T "wordCount" .WordCount }}  {{- end -}} {{- if $params.enableReadingTime | default true -}} - {{ partial "plugin/fontawesome.html" (dict "Style" "regular" "Icon" "clock") }} {{ T "readingTime" .ReadingTime }}  + {{ $reading_speed := .Site.Params.reading_speed | default 228 -}} + {{ $readingTime := int (math.Ceil (div (float .WordCount) $reading_speed)) }} + {{ partial "plugin/fontawesome.html" (dict "Style" "regular" "Icon" "clock") }} {{ T "readingTime" $readingTime }}  {{- end -}} {{- $comment := .Scratch.Get "comment" | default dict -}} {{- /* Visitor Count */ -}}