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] 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 }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} + {{ if $.Site.Params.ShowReadingTime }} + — ⏰ {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }} + {{ end }} - - ⏰ {{ .ReadingTime }} min read {{ if .Params.tags }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 240a556..b30f221 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,7 +8,9 @@ {{ end }} {{ with .Params.Author }}— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}{{ end }} - - ⏰ {{ .ReadingTime }} min read + {{ if $.Site.Params.ShowReadingTime }} + — ⏰ {{ .ReadingTime }} {{ $.Site.Params.MinuteReadingTime | default "min read" }} + {{ end }} {{ if .Params.tags }}