From 497d5da5a3eb360f6c386c3621e300c6a7f5f53a Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sun, 15 May 2022 17:38:30 -0700 Subject: [PATCH] word count in post lists + add qualitative desc. - Add qualitative description to reading time - Add word count + reading time to post list --- layouts/partials/post-meta.html | 25 ++++++++++++++----------- layouts/partials/posts.html | 1 + layouts/partials/wordcount.html | 7 +++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html index 192acf0..d7aab02 100644 --- a/layouts/partials/post-meta.html +++ b/layouts/partials/post-meta.html @@ -1,13 +1,16 @@ {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $logURL := printf "%scontent/%s" .Site.Params.logUrlPrefix .File.Path }} -Posted - by {{- partial "indieweb-author.html" -}} on his Website{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and Gemini capsule{{- end -}}. - {{ if lt .Date .Lastmod -}} -
- Last updated . Changelog. - {{- end }} -
- {{ .WordCount }} words - {{- with .ReadingTime }}, - a{{ if hasPrefix (string .) "8" }}n{{ end }} - read{{- end }} + diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html index 5340468..49ede03 100644 --- a/layouts/partials/posts.html +++ b/layouts/partials/posts.html @@ -40,6 +40,7 @@ Posted , updated

{{ .Description }}

+

{{- partial "wordcount.html" . -}}

{{- end }} diff --git a/layouts/partials/wordcount.html b/layouts/partials/wordcount.html index 571188e..b6dc192 100644 --- a/layouts/partials/wordcount.html +++ b/layouts/partials/wordcount.html @@ -1,5 +1,4 @@ {{ .WordCount }} words -{{- with .ReadingTime }}, - a{{ if hasPrefix (string .) "8" }}n -{{- end }} - {{ . }} minute read{{ end -}} + {{- 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 }}