aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-read-time.html
blob: bc32f416874e086ce6a78970b873c42655ffc2e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{{- $seconds := mul (div .WordCount 180.0) 60.0 -}}
{{- $seconds = printf "%.0f" $seconds -}}
{{- if eq $seconds "0" -}}
  {{- $seconds = "1" -}}
{{- end -}}

<micro-metadata-readtime>
  {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/clock.svg")) -}}
  <read-time title="Takes {{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read">{{ $seconds }} sec</read-time>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
</micro-metadata-readtime>
{{- /* This comment removes trailing newlines and white spaces. */ -}}