From bb505f8fc86e47e277907437fd3240a58670759c Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 3 Apr 2025 14:11:51 +0800 Subject: feat: add sponsor page and link --- content/sponsor.md | 15 +++++++++++++++ layouts/_default/single.html | 3 +++ layouts/shortcodes/postcount.html | 1 + layouts/shortcodes/wordcount.html | 5 +++++ 4 files changed, 24 insertions(+) create mode 100644 content/sponsor.md create mode 100644 layouts/shortcodes/postcount.html create mode 100644 layouts/shortcodes/wordcount.html diff --git a/content/sponsor.md b/content/sponsor.md new file mode 100644 index 00000000..2a2d9367 --- /dev/null +++ b/content/sponsor.md @@ -0,0 +1,15 @@ +--- +title: 赞助 +date: 2025-04-03 13:23:02 +draft: false +--- + +极客死亡计划上已经发布了 {{< postcount >}} 篇文章,共 {{< wordcount >}} 字。 + +如果你觉得我的内容对你有帮助,可以考虑支持我,减轻我在域名续费和资源存储上的开销,以支持我继续创作和分享,同时也给我一些鼓励。你可以在赞助时留言,自 2025 年 4 月 3 日起的赞助者,名字和留言都会显示在这里。 + +{{< img src="https://image.guhub.cn//uPic/IMG_3151-2.jpg" class="center small" >}} + +#### 赞助者名单 + +*还没有人赞助* diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2661bb11..e23acad0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -48,6 +48,9 @@ {{ end }} {{ .Site.Params.postHeaderContent | safeHTML }} {{ .Content }} + {{ if and (eq .Site.Language.Lang "zh") (eq .Section "posts") }} +

如果你觉得文章对你有帮助,可以考虑赞助作者

+ {{ end }} {{ if in .Site.Params.mainSections .Type }} diff --git a/layouts/shortcodes/postcount.html b/layouts/shortcodes/postcount.html new file mode 100644 index 00000000..68da6893 --- /dev/null +++ b/layouts/shortcodes/postcount.html @@ -0,0 +1 @@ +{{ len (where .Site.RegularPages "Section" "posts") }} diff --git a/layouts/shortcodes/wordcount.html b/layouts/shortcodes/wordcount.html new file mode 100644 index 00000000..3b302b82 --- /dev/null +++ b/layouts/shortcodes/wordcount.html @@ -0,0 +1,5 @@ +{{ $total := 0 }} +{{ range where .Site.RegularPages "Section" "posts" }} + {{ $total = add $total .WordCount }} +{{ end }} +{{ $total }} -- cgit v1.2.3