+
如果你想回应这篇文章,请在你的博客或社交媒体中链接本页面,然后在下面的表单中提交你的页面链接。
+
+
+
关于 Webmention 的更多信息 以及
为什么要这么做?
+
+
+
+
+
+
+{{ end }}
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
new file mode 100644
index 0000000..0d55fc1
--- /dev/null
+++ b/layouts/_default/term.html
@@ -0,0 +1,36 @@
+{{ define "main" }}
+
+
{{ .Title }}
+
+
+ {{ range .Pages }}
+
+
+
+
+
+ {{ .Title }}
+
+
+ {{ else }}
+
该分类下还没有文章。
+ {{ end }}
+
+
+{{ end }}
diff --git a/layouts/archives/single.html b/layouts/archives/single.html
new file mode 100644
index 0000000..6c43aac
--- /dev/null
+++ b/layouts/archives/single.html
@@ -0,0 +1,94 @@
+{{ define "main" }}
+
+ {{ if .Site.Params.postSearch }}
+
+
+ {{ end }} {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} {{
+ $excludePosts := where $allPosts "Params.categories" "intersect" (slice
+ "往昔") }} {{ $postPages := $allPosts | complement $excludePosts }} {{ if
+ .Site.Params.showPostCount }}
+ 共有 {{ len $postPages }} 篇文章
+ {{ end }}
+
+
+ {{ if gt (len $postPages) 0 }} {{ $pagesToShow := $postPages.ByDate.Reverse
+ }} {{ $currentYear := 0 }} {{ range $pagesToShow }} {{ if .Date }} {{ $year
+ := .Date.Year }} {{ if and (.Site.Params.groupByYear) (ne $year
+ $currentYear) }}
+ {{ $year }}
+ {{ $currentYear = $year }} {{ end }} {{ end }}
+
+ -
+
+
+
+
+
+ {{ .Title }}
+
+ {{ end }} {{ else }}
+ - 暂无文章
+ {{ end }}
+
+
+
+{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
new file mode 100644
index 0000000..d975ecb
--- /dev/null
+++ b/layouts/index.html
@@ -0,0 +1 @@
+{{ define "main" }} {{ .Content }} {{ end }}
diff --git a/layouts/no-comments/single.html b/layouts/no-comments/single.html
new file mode 100644
index 0000000..58160be
--- /dev/null
+++ b/layouts/no-comments/single.html
@@ -0,0 +1,136 @@
+{{ define "main" }}
+{{ if eq .Type "blog" }}
+{{ if not .Params.menu }}
+
{{ .Title }}
+{{ if .Date }}
+
+
+
+
+
+{{ end }}
+{{ end }}
+{{ end }}
+
+
{{ .Content }}
+
+
+ {{ range (.GetTerms "tags") }}
+ #{{ .LinkTitle }}
+ {{ end }}
+
+
+{{ $upvoteEnabled := default .Site.Params.upvote .Params.upvote }}
+{{ if $upvoteEnabled }}
+
+
+
+{{ end }}
+
+
+{{ $tocEnabled := default .Site.Params.toc .Params.toc }}
+{{ if $tocEnabled }}
+
+{{ partial "toc.html" . }}
+
+{{ end }}
+{{ end }}
diff --git a/layouts/partials/archives-list.html b/layouts/partials/archives-list.html
new file mode 100644
index 0000000..b9767f7
--- /dev/null
+++ b/layouts/partials/archives-list.html
@@ -0,0 +1,30 @@
+{{ $allPages := where .Site.RegularPages "Type" "in" (slice "posts" "blog") }}
+{{ $visiblePages := where $allPages "Params.hidden" "!=" true }}
+{{ $pagesToShow := $visiblePages.ByDate.Reverse }}
+
+
+
归档
+
+
共有 {{ len $pagesToShow }} 篇文章
+
+
+ {{ $currentYear := 0 }}
+ {{ range $pagesToShow }}
+ {{ $year := .Date.Year }}
+ {{ if ne $year $currentYear }}
+ {{ $year }}
+ {{ $currentYear = $year }}
+ {{ end }}
+ -
+
+
+
+
+
+ {{ .Title }}
+
+ {{ end }}
+
+
diff --git a/layouts/partials/custom_body.html b/layouts/partials/custom_body.html
new file mode 100644
index 0000000..529771a
--- /dev/null
+++ b/layouts/partials/custom_body.html
@@ -0,0 +1,5 @@
+
+
+
diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html
new file mode 100644
index 0000000..4ea89a1
--- /dev/null
+++ b/layouts/partials/custom_head.html
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html
new file mode 100644
index 0000000..ccf1a5d
--- /dev/null
+++ b/layouts/partials/favicon.html
@@ -0,0 +1,2 @@
+{{ with .Site.Params.favicon }}
+
{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
new file mode 100644
index 0000000..cc5e269
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1 @@
+
© 2024 - 2025 | Made with ❤️ by Verdant.
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..66fa74b
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,4 @@
+
+ {{ .Site.Title }}
+
+
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
new file mode 100644
index 0000000..5b9d089
--- /dev/null
+++ b/layouts/partials/nav.html
@@ -0,0 +1,7 @@
+
首页
+{{ range .Site.Menus.main }}
+
{{ .Name }}
+{{ end }}
+{{ with .Site.GetPage "/blog" }}
+
Blog
+{{ end }}
diff --git a/layouts/partials/seo_tags.html b/layouts/partials/seo_tags.html
new file mode 100644
index 0000000..06e90cd
--- /dev/null
+++ b/layouts/partials/seo_tags.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+{{ template "_internal/opengraph.html" . }}
+
+
+{{ template "_internal/twitter_cards.html" . }}
+
+
+{{ template "_internal/schema.html" . }}
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
new file mode 100644
index 0000000..f108da6
--- /dev/null
+++ b/layouts/partials/style.html
@@ -0,0 +1,531 @@
+
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..66936a4
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,91 @@
+{{/* 根据页面内容生成目录 */}}
+{{ if and .TableOfContents (ne .TableOfContents "
") }}
+
+
+
+{{ end }}
\ No newline at end of file
diff --git a/layouts/robots.txt b/layouts/robots.txt
new file mode 100644
index 0000000..0326f5c
--- /dev/null
+++ b/layouts/robots.txt
@@ -0,0 +1,2 @@
+User-Agent: *
+Sitemap: {{ "sitemap.xml" | absURL }}
diff --git a/layouts/shortcodes/archives-list.html b/layouts/shortcodes/archives-list.html
new file mode 100644
index 0000000..b9767f7
--- /dev/null
+++ b/layouts/shortcodes/archives-list.html
@@ -0,0 +1,30 @@
+{{ $allPages := where .Site.RegularPages "Type" "in" (slice "posts" "blog") }}
+{{ $visiblePages := where $allPages "Params.hidden" "!=" true }}
+{{ $pagesToShow := $visiblePages.ByDate.Reverse }}
+
+
+
归档
+
+
共有 {{ len $pagesToShow }} 篇文章
+
+
+ {{ $currentYear := 0 }}
+ {{ range $pagesToShow }}
+ {{ $year := .Date.Year }}
+ {{ if ne $year $currentYear }}
+ {{ $year }}
+ {{ $currentYear = $year }}
+ {{ end }}
+ -
+
+
+
+
+
+ {{ .Title }}
+
+ {{ end }}
+
+
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html
new file mode 100644
index 0000000..c6c1a3e
--- /dev/null
+++ b/layouts/shortcodes/recent-posts.html
@@ -0,0 +1,55 @@
+{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{
+$recent := first 5 $pages.ByDate.Reverse }}
+
+
+ {{ if $recent }}
+
+ {{ range $index, $page := $recent }}
+ -
+
+
+
+ {{ .Title }}
+
+ {{ end }}
+
+ {{ else }}
+
暂无文章
+ {{ end }}
+
diff --git a/layouts/shortcodes/word-count.html b/layouts/shortcodes/word-count.html
new file mode 100644
index 0000000..0621ed9
--- /dev/null
+++ b/layouts/shortcodes/word-count.html
@@ -0,0 +1,74 @@
+{{ $scratch := newScratch }}
+{{ if eq (.Get 0) "posts" }}
+ {{/* 统计所有博客文章 */}}
+ {{ range where site.RegularPages "Type" "in" (slice "posts" "jottings" "readings" "tech") }}
+ {{ $scratch.Add "wordcount" .WordCount }}
+ {{ end }}
+{{ else if eq (.Get 0) "all" }}
+ {{/* 统计所有内容 */}}
+ {{ range where site.RegularPages "Type" "in" (slice "posts" "about" "newsgroup" "links" "jottings" "readings" "tech") }}
+ {{ $scratch.Add "wordcount" .WordCount }}
+ {{ end }}
+{{ end }}
+
+{{ $count := $scratch.Get "wordcount" }}
+{{ if gt $count 0 }}
+ {{ $count }} 字,
+
+ {{/* 名著数据库(字数单位:汉字) */}}
+ {{ $classics := slice
+ (dict "name" "红楼梦" "author" "曹雪芹" "country" "(中)" "words" 731017)
+ (dict "name" "源氏物语" "author" "紫式部" "country" "(日)" "words" 876000)
+ (dict "name" "假面的告白" "author" "三岛由纪夫" "country" "(日)" "words" 86000)
+ (dict "name" "金阁寺" "author" "三岛由纪夫" "country" "(日)" "words" 125000)
+ (dict "name" "了不起的盖茨比" "author" "菲茨杰拉德" "country" "(美)" "words" 49800)
+ (dict "name" "傲慢与偏见" "author" "简·奥斯汀" "country" "(英)" "words" 183000)
+ (dict "name" "呐喊" "author" "鲁迅" "country" "(中)" "words" 152000)
+ (dict "name" "罗生门" "author" "芥川龙之介" "country" "(日)" "words" 35800)
+ (dict "name" "老人与海" "author" "海明威" "country" "(美)" "words" 26800)
+ (dict "name" "简爱" "author" "夏洛蒂·勃朗特" "country" "(英)" "words" 322000)
+ (dict "name" "三国演义" "author" "罗贯中" "country" "(中)" "words" 640000)
+ (dict "name" "雪国" "author" "川端康成" "country" "(日)" "words" 78000)
+ (dict "name" "杀死一只知更鸟" "author" "哈珀·李" "country" "(美)" "words" 187000)
+ (dict "name" "1984" "author" "乔治·奥威尔" "country" "(英)" "words" 123000)
+ (dict "name" "围城" "author" "钱钟书" "country" "(中)" "words" 257000)
+ (dict "name" "我是猫" "author" "夏目漱石" "country" "(日)" "words" 402000)
+ (dict "name" "飘" "author" "玛格丽特·米切尔" "country" "(美)" "words" 802000)
+ (dict "name" "呼啸山庄" "author" "艾米莉·勃朗特" "country" "(英)" "words" 282000)
+ }}
+
+ {{/* 寻找最接近的名著 */}}
+ {{ $closest := dict "diff" 999999999 "book" (index $classics 0) }}
+ {{ range $book := $classics }}
+ {{ $ratio := div (float $count) $book.words }}
+ {{ if and (ge $ratio 0.8) (le $ratio 1.2) }}
+ {{ $diff := sub $ratio 1.0 }}
+ {{ if lt $diff 0 }}{{ $diff = mul $diff -1 }}{{ end }}
+ {{ if lt $diff $closest.diff }}
+ {{ $closest = dict "diff" $diff "book" $book }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+
+ {{/* 输出对比结果 */}}
+ {{ with $closest.book }}
+ 约等于 《{{ .name }}》 的{{ div (float $count) .words | printf "%.1f" }}倍
+ {{ else }}
+ {{/* 未找到匹配时显示长度最接近的名著 */}}
+ {{ $closestBook := index $classics 0 }}
+ {{ $minDiff := sub $count $closestBook.words }}
+ {{ if lt $minDiff 0 }}{{ $minDiff = mul $minDiff -1 }}{{ end }}
+ {{ range $classics }}
+ {{ $currDiff := sub $count .words }}
+ {{ if lt $currDiff 0 }}{{ $currDiff = mul $currDiff -1 }}{{ end }}
+ {{ if lt $currDiff $minDiff }}
+ {{ $closestBook = . }}
+ {{ $minDiff = $currDiff }}
+ {{ end }}
+ {{ end }}
+ ≈ {{ $closestBook.name }}{{ div (float $count) $closestBook.words | printf "%.1f" }}倍
+ {{ end }}
+
+{{ else }}
+ 0字
+{{ end }}
--
cgit v1.2.3