aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-read-time.html
blob: 69c0ffaadcf0cfce4079a572a683d8325a312d0c (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 title="Takes {{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read">
  {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) -}}
  <span>{{ $seconds }} sec</span>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
</micro-metadata-readtime>
{{- /* This comment removes trailing newlines and white spaces. */ -}}