mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-12-18 06:42:10 +00:00
19d5fe2b00
Use partialCached to avoid any perf penalty. TODO: limit the scope I pass to them. I noticed a teeny tiny perf improvement after doing this, probably because now some giant data structures only need to be generated once.
19 lines
794 B
HTML
19 lines
794 B
HTML
{{ $displayCount := string .WordCount -}}
|
|
{{- if gt .WordCount 5000 -}}
|
|
{{- $thousands := string (div .WordCount 1000) -}}
|
|
{{- $displayCount = printf "%s thousand" $thousands -}}
|
|
About
|
|
{{- end -}}
|
|
<data itemprop="wordCount" value="{{ .WordCount }}">
|
|
{{- $displayCount -}}
|
|
</data> words
|
|
{{- with .ReadingTime -}}
|
|
{{- $displayTime := string . -}}
|
|
{{- if gt . 60 -}}
|
|
{{- $hours := div . 60 -}}
|
|
{{- $minutes := mod . 60 -}}
|
|
{{- $displayTime = (printf "%d hour and %d" $hours $minutes) | safeHTML -}}
|
|
{{- end -}}
|
|
; a {{ if lt . 10 }}short {{ else if and (gt . 20) (lt . 30) }}somewhat long {{ else if and (gt . 29) (lt . 60) }}long {{ else if gt . 59 }} very long {{ end -}}
|
|
<time itemprop="timeRequired" datetime="PT{{ . }}M">{{ $displayTime }} minute</time> read
|
|
{{- end -}}
|