From 13ca81158d2376a0378fbca8e27a71c6acc09798 Mon Sep 17 00:00:00 2001 From: revsuine Date: Mon, 25 Nov 2024 02:14:56 +0000 Subject: [PATCH] layouts/_default/single.html, README.md: add showWordCount option --- README.md | 11 +++++++++++ layouts/_default/single.html | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c19ed12..a4f2168 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,14 @@ the files in my Hugo site's root directory. This is the theme used on [my website](https://revsuine.xyz/). You can see the website source [here](https://git.revsuine.xyz/revsuine/revsuine.xyz). +## Configuration + +The same as [upstream](https://github.com/panr/hugo-theme-terminal?tab=readme-ov-file#how-to-configure), with the +following changes: + +```ini +[params] + # whether to show a page's word count + showWordCount = true +``` + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 676b198..8ec4839 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -16,7 +16,10 @@ {{ . }} {{- end -}} {{- if and (.Param "readingTime") (eq (.Param "readingTime") true) -}} - {{ .ReadingTime }} {{ $.Site.Params.minuteReadingTime | default "min read" }} ({{ .WordCount }} {{ $.Site.Params.words | default "words" }}) + {{ .ReadingTime }} {{ $.Site.Params.minuteReadingTime | default "min read" }} + {{- end -}} + {{- if and (.Param "showWordCount") (eq (.Param "readingTime") true) -}} + {{ .WordCount }} {{ $.Site.Params.words | default "words" }} {{- end -}}