From 32ea5dc5cfe2f8a801c3ca22cef0eddd66370e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20P=C3=A4pper?= Date: Fri, 15 Feb 2019 09:35:16 +0100 Subject: [PATCH 1/2] Added ReadingTime indication to give the reader an idea of the read time in minutes --- layouts/_default/list.html | 2 ++ layouts/_default/single.html | 1 + 2 files changed, 3 insertions(+) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 5009d32..f9d431a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -14,6 +14,8 @@ {{ with .Params.Author }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} + - ⏰ {{ .ReadingTime }} min read + {{ if .Params.tags }} {{ range .Params.tags }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 61bbbf8..240a556 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,6 +8,7 @@ {{ end }} {{ with .Params.Author }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} + - ⏰ {{ .ReadingTime }} min read {{ if .Params.tags }} From ace5be049fc3546176adef40900bc3e29975fba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20P=C3=A4pper?= Date: Thu, 21 Feb 2019 08:21:47 +0100 Subject: [PATCH 2/2] Introduced boolean variable showReadingTime to activate reading time feature. Added translation for 'min read'. Changed hyphen to em dash. --- README.md | 3 +++ layouts/_default/list.html | 4 +++- layouts/_default/single.html | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d23ad81..2ad22c5 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ paginate = 5 defaultTheme = "dark" # if you set this to 0, only submenu trigger will be visible showMenuItems = 2 + # Enable to show reading time in minutes for posts + showReadingTime = false [languages] [languages.en] @@ -80,6 +82,7 @@ paginate = 5 readOtherPosts = "Read other posts" newerPosts = "Newer posts" olderPosts = "Older posts" + minuteReadingTime = "min read" [languages.en.params.logo] logoText = "hello friend" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f9d431a..6da2c7e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -12,9 +12,11 @@ {{ .Date.Format "2006-01-02" }} {{ with .Params.Author }}{{ end }} + {{ if $.Site.Params.ShowReadingTime }} + — ⏰ {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }} + {{ end }} - - ⏰ {{ .ReadingTime }} min read {{ if .Params.tags }} {{ end }} {{ with .Params.Author }}{{ end }} - - ⏰ {{ .ReadingTime }} min read + {{ if $.Site.Params.ShowReadingTime }} + — ⏰ {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }} + {{ end }} {{ if .Params.tags }}