aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-read-time.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-23 20:36:32 -0400
committertdro <tdro@noreply.example.com>2022-06-23 20:36:32 -0400
commit0fc6a14279eb1640d2323513ea2744e5fc56245b (patch)
treed2bfc8196026b6dafa9248db30d512ad836c5b9b /themes/default/layouts/partials/meta-read-time.html
parent3c041d57e31fface55bd9103a1f73af663854955 (diff)
downloadcanory-0fc6a14279eb1640d2323513ea2744e5fc56245b.tar.gz
canory-0fc6a14279eb1640d2323513ea2744e5fc56245b.tar.bz2
canory-0fc6a14279eb1640d2323513ea2744e5fc56245b.zip
themes/default/layouts/partials/meta-read-time: Lowest time in 1 second
Diffstat (limited to 'themes/default/layouts/partials/meta-read-time.html')
-rw-r--r--themes/default/layouts/partials/meta-read-time.html12
1 files changed, 8 insertions, 4 deletions
diff --git a/themes/default/layouts/partials/meta-read-time.html b/themes/default/layouts/partials/meta-read-time.html
index 7222fc6..b3b1839 100644
--- a/themes/default/layouts/partials/meta-read-time.html
+++ b/themes/default/layouts/partials/meta-read-time.html
@@ -1,6 +1,10 @@
-{{ $seconds := mul (div .WordCount 180.0) 60.0 }}
-{{ $format := printf "%.0f" $seconds }}
+{{- $seconds := mul (div .WordCount 180.0) 60.0 -}}
+{{- $seconds = printf "%.0f" $seconds -}}
-<read-time title="Takes {{ $format }} seconds to read">
- {{ $format }} sec
+{{- if eq $seconds "0" -}}
+ {{- $seconds = "1" -}}
+{{- end -}}
+
+<read-time title="Takes {{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read">
+ {{ $seconds }} sec
</read-time>