diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-03 14:11:51 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-03 14:11:51 +0800 |
| commit | bb505f8fc86e47e277907437fd3240a58670759c (patch) | |
| tree | 1472d3c85fb8ee82832430278d3b8d9676a5f8ea | |
| parent | c896f61fb6cc69b2cc65be3a5f5e28ddd2b90945 (diff) | |
feat: add sponsor page and link
| -rw-r--r-- | content/sponsor.md | 15 | ||||
| -rw-r--r-- | layouts/_default/single.html | 3 | ||||
| -rw-r--r-- | layouts/shortcodes/postcount.html | 1 | ||||
| -rw-r--r-- | layouts/shortcodes/wordcount.html | 5 |
4 files changed, 24 insertions, 0 deletions
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" >}} + +#### 赞助者名单 + +<span style="font-size:90%">*还没有人赞助*</span> 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") }} + <p style="font-size: 0.9rem">如果你觉得文章对你有帮助,可以考虑<a href="/sponsor">赞助作者</a></p> + {{ end }} </div> {{ 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 }} |
