aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-readtime.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/partials/meta-readtime.html')
-rw-r--r--themes/default/layouts/partials/meta-readtime.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/themes/default/layouts/partials/meta-readtime.html b/themes/default/layouts/partials/meta-readtime.html
new file mode 100644
index 0000000..43b5303
--- /dev/null
+++ b/themes/default/layouts/partials/meta-readtime.html
@@ -0,0 +1,12 @@
+{{- $seconds := mul (div .WordCount 180.0) 60.0 -}}
+{{- $seconds = printf "%.0f" $seconds -}}
+{{- if eq $seconds "0" -}}
+ {{- $seconds = "1" -}}
+{{- end -}}
+
+<meta-readtime title="{{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read">
+ {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/eye.svg")) }}
+ <span>{{ $seconds }}s read</span>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}
+</meta-readtime>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}