hermit-V2/layouts/partials/readTime.html

10 lines
599 B
HTML
Raw Permalink Normal View History

2023-10-25 04:10:31 -04:00
{{- if .Site.Params.readTime }}
2023-09-23 01:03:29 -04:00
{{ .Site.Params.readTimeSeparator }}
{{ $rT := mul (div (.WordCount) 220.0) 60 }}
{{ $rTH := math.Floor (div $rT 3600) }}
{{ $rTM := math.Floor (div (mod $rT 3600) 60) }}
{{ $rTS := mod (mod $rT 3600) 60 }}
2023-10-25 04:10:31 -04:00
{{- if gt $rTH 0 }}{{ $rTH }}{{- cond (gt $rTH 1) " Hours" " Hour" -}}{{- end -}}
{{- if gt $rTM 0 }}{{- cond (gt $rTH 0) ", " "" -}}{{ $rTM }}{{- cond (gt $rTM 1) " Minutes" " Minute" -}}{{- end -}}
{{- if gt $rTS 0 }}{{- cond (gt $rTM 0) ", " "" -}}{{ $rTS }}{{- cond (gt $rTS 1) " Seconds" " Second" -}}{{- end -}}
{{- end }}