Added read time to posts that'll take longer than a minute to read

This commit is contained in:
Brandon Rozek 2022-05-05 21:29:17 -04:00
parent 3a7aeed035
commit b2b05cc29e
2 changed files with 9 additions and 1 deletions

View file

@ -236,4 +236,4 @@ nav li {
#webmentions img { max-height: 1.2em; margin-right: -1ex; }
.date-updated { margin-top: -8px; }
.date-updated { margin-top: -18px; }

View file

@ -15,6 +15,14 @@
{{- end }}
{{ end }}
{{ end }}
{{ $readTime := mul (div (countwords .Content) 220.0) 60 }}
{{ if gt $readTime 60 }}
<p>
Reading Time:
{{ math.Floor (div $readTime 60) }} minutes
and {{ mod $readTime 60 }} seconds.
</p>
{{ end }}
<!-- tags -->
<div id="tags">
<ul>