1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00

word count in post lists + add qualitative desc.

- Add qualitative description to reading time
- Add word count + reading time to post list
This commit is contained in:
Rohan Kumar 2022-05-15 17:38:30 -07:00
parent 5211581909
commit 497d5da5a3
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 18 additions and 15 deletions

View file

@ -1,13 +1,16 @@
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{- $logURL := printf "%scontent/%s" .Site.Params.logUrlPrefix .File.Path }} {{- $logURL := printf "%scontent/%s" .Site.Params.logUrlPrefix .File.Path }}
<ul>
<li>
Posted <time itemprop="dateCreated datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> Posted <time itemprop="dateCreated datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
by {{- partial "indieweb-author.html" -}} on his <a rel="canonical" itemprop="mainEntityOfPage url" class="u-url url" href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>{{- end -}}. by {{- partial "indieweb-author.html" -}} on his <a rel="canonical" itemprop="mainEntityOfPage url" class="u-url url" href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>{{- end -}}.
{{ if lt .Date .Lastmod -}} {{ if lt .Date .Lastmod -}}
<br> </li>
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ $logURL | strings.ReplaceRE `\.md` `.gmi` }}">Changelog</a>. <li>
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ $logURL | strings.ReplaceRE `\.md` `.gmi` }}">Changelog</a>
{{- end }} {{- end }}
<br> </li>
<span itemprop="wordCount">{{ .WordCount }}</span> words <li>
{{- with .ReadingTime }}, {{ partial "wordcount.html" }}
a{{ if hasPrefix (string .) "8" }}n{{ end }} </li>
<time itemprop="timeRequired" datetime="PT{{ . }}M">{{ . }} minute</time> read{{- end }} </ul>

View file

@ -40,6 +40,7 @@
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>, updated Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>, updated
<time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time> <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>
<p class="p-summary entry-summary" itemprop="description">{{ .Description }}</p> <p class="p-summary entry-summary" itemprop="description">{{ .Description }}</p>
<p>{{- partial "wordcount.html" . -}}</p>
</article> </article>
</li> </li>
{{- end }} {{- end }}

View file

@ -1,5 +1,4 @@
<span itemprop="wordCount">{{ .WordCount }}</span> words <span itemprop="wordCount">{{ .WordCount }}</span> words
{{- with .ReadingTime }}, {{- with .ReadingTime }},
a{{ if hasPrefix (string .) "8" }}n 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 }}
{{- end }} <time itemprop="timeRequired" datetime="PT{{ . }}M">{{ . }} minute</time> read{{- end }}
<span itemprop="timeRequired" content="PT{{ . }}M">{{ . }} minute</span> read{{ end -}}