aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-read-time.html
blob: 53e541ffa3346b1665c284f33c40b05771fff012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<micro-metadata-readtime>
  {{- $seconds := mul (div .WordCount 180.0) 60.0 -}}
  {{- $seconds = printf "%.0f" $seconds -}}

  {{- if eq $seconds "0" -}}
    {{- $seconds = "1" -}}
  {{- end -}}

  {{- safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/clock.svg")) -}}

  <read-time title="Takes {{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read">
    {{ $seconds }} sec
{{- /* This comment removes trailing newlines and white spaces. */ -}}
  </read-time>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
</micro-metadata-readtime>
{{- /* This comment removes trailing newlines and white spaces. */ -}}