diff --git a/layouts/partials/wordcount.html b/layouts/partials/wordcount.html index b6dc192..c23d73e 100644 --- a/layouts/partials/wordcount.html +++ b/layouts/partials/wordcount.html @@ -1,4 +1,19 @@ -{{ .WordCount }} words - {{- with .ReadingTime }}, - 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 }} - read{{- end }} +{{ $displayCount := string .WordCount -}} +{{- if gt .WordCount 5000 -}} +{{- $thousands := string (div .WordCount 1000) -}} +{{- $displayCount = printf "%s thousand" $thousands -}} +About +{{- end }} + + {{ $displayCount }} + words +{{- with .ReadingTime -}} + {{- $displayTime := string . -}} + {{- if gt . 60 -}} + {{- $hours := div . 60 -}} + {{- $minutes := mod . 60 -}} + {{- $displayTime = (printf "%d hour, %d minute" $hours $minutes) -}} + {{- 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 }} + read +{{- end }}