Added icons to publish date and reading time

This commit is contained in:
Brandon Rozek 2022-05-16 14:54:30 -04:00
parent 0cefeeb270
commit 2fbfe38e3d
2 changed files with 12 additions and 4 deletions

View file

@ -3,12 +3,19 @@
{{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}}
{{ $pubdate := .Date.Format $singlePageDateFormat }}
<p class="date">{{ $publishString }}<time class="dt-published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z0700" }}'>{{ $pubdate }}</time></p>
<p class="date">
<i class="fas fa-calendar"></i>
{{ $publishString }}
<time class="dt-published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z0700" }}'>{{ $pubdate }}</time>
</p>
{{- if and (not (.Scratch.Get "noDateUpdate")) .Lastmod }}
{{- $lastmod := .Lastmod.Format $singlePageDateFormat }}
{{- if ne $lastmod $pubdate }}
<p class="date-updated">Updated on <time class='dt-updated' datetime='{{ .Lastmod.Format "2006-01-02T15:04:05Z0700" }}'>{{ $lastmod }}</time></p>
<p class="date-updated">
Updated on
<time class='dt-updated' datetime='{{ .Lastmod.Format "2006-01-02T15:04:05Z0700" }}'>{{ $lastmod }}</time>
</p>
{{- end }}
{{ end }}
{{ end }}

View file

@ -2,7 +2,8 @@
{{ $readTime := mul (div (countwords .Content) 220.0) 60 }}
{{ if gt $readTime 60 }}
<p>
Reading Time:
{{ math.Ceil (div $readTime 60) }} minutes.
<i class="fas fa-stopwatch"></i>
{{ math.Ceil (div $readTime 60) }} minute
reading time
</p>
{{ end }}