From 96a4916cc3947b573aa2f6b46a58fabce271d0ad Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Thu, 28 Apr 2022 21:30:07 +0800 Subject: [PATCH] :sparkles: Feat: add total word count support in footer (#124) --- CHANGELOG.md | 1 + exampleSite/config.toml | 5 ++- .../theme-documentation-basics/index.en.md | 4 +- .../theme-documentation-basics/index.zh-cn.md | 2 + layouts/partials/footer.html | 41 +++++++++++-------- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caff33c2c..32d7d45e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. - :sparkles: Feat: link shortcode add `external-icon` option ([#96](https://github.com/Lruihao/FixIt/issues/96)) - :sparkles: Feat: add GitHub Corners support ([#106](https://github.com/Lruihao/FixIt/issues/106)) - :sparkles: Feat: add local avatar and gravatar support for post author ([#125](https://github.com/Lruihao/FixIt/issues/125)) +- :sparkles: Feat: add total word count support in footer ([#124](https://github.com/Lruihao/FixIt/issues/124)) - :sparkles: Feat: add "Edit this page" button support ([#103](https://github.com/Lruihao/FixIt/issues/103)) - :sparkles: Feat: add count badge for taxonomy ([#122](https://github.com/Lruihao/FixIt/issues/122)) - :zap: Perf: add Gravatar config support diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1c1fa9c21..90d980753 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -593,12 +593,15 @@ enableEmoji = true # whether to show the author # 是否显示作者 author = true - # site creation time + # site creation year # 网站创立年份 since = 2021 # Site creation time since v0.2.14 # 网站创立时间 since v0.2.14 siteTime = '2021-12-18T16:15:22+08:00' + # whether to show total word count of site content since v0.2.14 + # 是否显示网站内容总字数 since v0.2.14 + wordCount = true # Public network security only in China (HTML format is supported) since v0.2.12 # 公网安备信息,仅在中国使用 (支持 HTML 格式) since v0.2.12 gov = "" diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index a6b318d36..ed4ac4153 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -291,10 +291,12 @@ Please open the code block below to view the complete sample configuration :(far copyright = true # {{< version 0.2.0 >}} whether to show the author author = true - # Site creation time + # Site creation year since = 2019 # {{< version 0.2.14 >}} Site creation time siteTime = '' # e.g. '2019-02-03T19:30:34+08:00' + # {{< version 0.2.14 >}} whether to show total word count of site content + wordCount = true # ICP info only in China (HTML format is supported) icp = "" # license info (HTML format is supported) diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 76e930419..1e6495c99 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -303,6 +303,8 @@ hugo since = 2019 # {{< version 0.2.14 >}} 网站创立时间 siteTime = '' # 例:'2019-02-03T19:30:34+08:00' + # {{< version 0.2.14 >}} 是否显示网站内容总字数 + wordCount = true # {{< version 0.2.12 >}} 公网安备信息,仅在中国使用(支持 HTML 格式) gov = "" # {{< version 0.2.12 changed >}} ICP 备案信息,仅在中国使用(支持 HTML 格式) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 75b2a967a..b531a47b5 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -40,26 +40,36 @@ {{- /* License */ -}} {{- with .Site.Params.footer.license -}} - {{- if $.Site.Params.footer.copyright | or $.Site.Params.footer.author -}} - - {{- end -}} - {{ . | safeHTML }} + {{ . | safeHTML }} {{- end -}} {{- end -}} - + {{- /* TODO: The parameter `ibruce.siteTime` will be deleted in v0.2.15 */ -}} + {{- if .Site.Params.ibruce.siteTime | or .Site.Params.footer.siteTime | or .Site.Params.footer.wordCount -}} + + {{- end -}} {{- /* 不蒜子 */ -}} {{- if eq .Site.Params.ibruce.enable true -}} {{- end -}} @@ -69,13 +79,10 @@ {{- with .Site.Params.footer.gov -}} {{ . | safeHTML }} {{- end -}} - + {{- /* ICP */ -}} {{- with .Site.Params.footer.icp -}} - {{- if $.Site.Params.footer.gov -}} - - {{- end -}} - {{ . | safeHTML }} + {{ . | safeHTML }} {{- end -}} {{- end -}}