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 | 2772544294afea137e92ed095e1e5e0901426fee (patch) | |
| tree | f4336a9ced571b36f3d7dc1d7799ba39392450da /layouts | |
| parent | 5b17aaa86f546e12ffdaee4e1417eca020b5b565 (diff) | |
feat: add sponsor page and link
Former-commit-id: bb505f8fc86e47e277907437fd3240a58670759c
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/single.html | 3 | ||||
| -rw-r--r-- | layouts/shortcodes/postcount.html | 1 | ||||
| -rw-r--r-- | layouts/shortcodes/wordcount.html | 5 |
3 files changed, 9 insertions, 0 deletions
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 }} |
