From 31cd7a3067a9996b7140aeaefb6c97e08db2f78f Mon Sep 17 00:00:00 2001 From: verdant Date: Sat, 11 Apr 2026 18:27:20 +0800 Subject: update --- layouts/_default/baseof.html | 64 +- layouts/_default/single.html | 25 +- layouts/_markup/render-blockquote.html | 107 --- layouts/archives/single.html | 7 +- layouts/layouts/404.html | 29 - layouts/layouts/_default/_markup/render-image.html | 4 - layouts/layouts/_default/baseof.html | 33 - layouts/layouts/_default/list.html | 70 -- layouts/layouts/_default/rss.xml | 82 -- layouts/layouts/_default/single.html | 319 -------- layouts/layouts/_default/term.html | 36 - layouts/layouts/archives/single.html | 96 --- layouts/layouts/index.html | 3 - layouts/layouts/partials/custom_body.html | 3 - layouts/layouts/partials/custom_head.html | 21 - layouts/layouts/partials/favicon.html | 2 - layouts/layouts/partials/footer.html | 8 - layouts/layouts/partials/header.html | 4 - layouts/layouts/partials/nav.html | 6 - layouts/layouts/partials/post_meta.html | 39 - layouts/layouts/partials/seo_tags.html | 15 - layouts/layouts/partials/style.html | 846 --------------------- layouts/layouts/partials/toc.html | 91 --- layouts/layouts/robots.txt | 2 - layouts/layouts/shortcodes/archives-list.html | 30 - layouts/layouts/shortcodes/book.html | 9 - layouts/layouts/shortcodes/music.html | 37 - layouts/layouts/shortcodes/recent-posts.html | 24 - layouts/layouts/shortcodes/word-count.html | 41 - layouts/partials/custom_head.html | 18 +- layouts/partials/footer.html | 12 +- layouts/partials/post_meta.html | 37 +- layouts/partials/style.html | 811 -------------------- layouts/partials/toc.html | 110 +-- layouts/shortcodes/archives-list.html | 57 +- layouts/shortcodes/word-count.html | 70 +- 36 files changed, 156 insertions(+), 3012 deletions(-) delete mode 100644 layouts/_markup/render-blockquote.html delete mode 100644 layouts/layouts/404.html delete mode 100644 layouts/layouts/_default/_markup/render-image.html delete mode 100644 layouts/layouts/_default/baseof.html delete mode 100644 layouts/layouts/_default/list.html delete mode 100644 layouts/layouts/_default/rss.xml delete mode 100644 layouts/layouts/_default/single.html delete mode 100644 layouts/layouts/_default/term.html delete mode 100644 layouts/layouts/archives/single.html delete mode 100644 layouts/layouts/index.html delete mode 100644 layouts/layouts/partials/custom_body.html delete mode 100644 layouts/layouts/partials/custom_head.html delete mode 100644 layouts/layouts/partials/favicon.html delete mode 100644 layouts/layouts/partials/footer.html delete mode 100644 layouts/layouts/partials/header.html delete mode 100644 layouts/layouts/partials/nav.html delete mode 100644 layouts/layouts/partials/post_meta.html delete mode 100644 layouts/layouts/partials/seo_tags.html delete mode 100644 layouts/layouts/partials/style.html delete mode 100644 layouts/layouts/partials/toc.html delete mode 100644 layouts/layouts/robots.txt delete mode 100644 layouts/layouts/shortcodes/archives-list.html delete mode 100644 layouts/layouts/shortcodes/book.html delete mode 100644 layouts/layouts/shortcodes/music.html delete mode 100644 layouts/layouts/shortcodes/recent-posts.html delete mode 100644 layouts/layouts/shortcodes/word-count.html delete mode 100644 layouts/partials/style.html (limited to 'layouts') diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ebc6a41..b78e7ef 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,44 +1,44 @@ - - ______ ____ _____ _____ _____ _________ _______ _ __ _ _ - .' ___ ||_ \|_ _||_ _||_ _| | _ _ | |_ __ \ / |_ [ | / |_ / |_ -/ .' \_| | \ | | | | | | |_/ | | \_|.---. _ .--. _ .--. _ __ | |__) |_ .--. ,--. `| |-'.---. | |--. .---.`| |-'`| |-' -| | ____ | |\ \| | | ' ' | | | / /__\\[ `/'`\][ `/'`\][ \ [ ] | ___/[ `/'`\]`'_\ : | | / /'`\] | .-. |/ /__\\| | | | -\ `.___] |_| |_\ |_ \ \__/ / _| |_ | \__., | | | | \ '/ / _| |_ | | // | |,| |,| \__. | | | || \__.,| |, | |, - `._____.'|_____|\____| `.__.' |_____| '.__.'[___] [___] [\_: / |_____| [___] \'-;__/\__/'.___.'[___]|__]'.__.'\__/ \__/ - \__.' - - "A man is not dead while his name is still spoken." - - - - - - {{- partial "favicon.html" . -}} - {{ .Title }} + + + + + + {{- partial "favicon.html" . -}} + {{ .Title }} - {{- partial "seo_tags.html" . -}} - + {{- partial "seo_tags.html" . -}} + - {{ with .OutputFormats.Get "rss" -}} {{ printf ` - - ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - {{- partial "style.html" . -}} + {{ with .OutputFormats.Get "rss" -}} {{ printf ` + + ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - - {{- partial "custom_head.html" . -}} - + {{- partial "custom_head.html" . -}} + - -
{{- block "main" . }}{{- end }}
- + +
{{- block "main" . }}{{- end }}
+ - - {{- partial "custom_body.html" . -}} - + {{- partial "custom_body.html" . -}} + + + ______ ____ _____ _____ _____ _________ _______ _ __ _ _ .' ___ ||_ \|_ _||_ + _||_ _| | _ _ | |_ __ \ / |_ [ | / |_ / |_ / .' \_| | \ | | | | | | |_/ | | + \_|.---. _ .--. _ .--. _ __ | |__) |_ .--. ,--. `| |-'.---. | |--. .---.`| + |-'`| |-' | | ____ | |\ \| | | ' ' | | | / /__\\[ `/'`\][ `/'`\][ \ [ ] | + ___/[ `/'`\]`'_\ : | | / /'`\] | .-. |/ /__\\| | | | \ `.___] |_| |_\ |_ \ + \__/ / _| |_ | \__., | | | | \ '/ / _| |_ | | // | |,| |,| \__. | | | || + \__.,| |, | |, `._____.'|_____|\____| `.__.' |_____| '.__.'[___] [___] [\_: + / |_____| [___] \'-;__/\__/'.___.'[___]|__]'.__.'\__/ \__/ \__.' "A man is + not dead while his name is still spoken." + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d7b9807..ee0b227 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -12,6 +12,24 @@ {{ .Title }} +
+ + + +
+ +
{{ .Content }}
@@ -127,9 +145,9 @@ -{{ $tocEnabled := default .Site.Params.toc .Params.toc }} {{ if $tocEnabled }} -
{{ partial "toc.html" . }}
-{{ end }} + + + @@ -308,5 +326,6 @@ {{ end }} {{ end }} +

有想对我说的?发一封邮件吧

{{ end }} diff --git a/layouts/_markup/render-blockquote.html b/layouts/_markup/render-blockquote.html deleted file mode 100644 index c11de7e..0000000 --- a/layouts/_markup/render-blockquote.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -{{ $emojis := dict - "caution" "🚨" - "important" "☝️" - "note" "ℹ️" - "tip" "💡" - "warning" "⚠️" - "announcement" "📣" -}} - -{{ if eq .Type "alert" }} -
-
- {{ with .AlertTitle }} - {{.}} - {{ else }} - {{ index $emojis .AlertType }} - {{ end }} -
-
- {{ .Text }} -
-
-{{ else }} -
- {{ .Text }} -
-{{ end }} diff --git a/layouts/archives/single.html b/layouts/archives/single.html index be44c9f..fea6ac2 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -1,7 +1,12 @@ {{ define "main" }}
-{{- partial "header.html" . -}} + +

{{ .Site.Title }}

+
+
+ + {{ if .Data.Singular }}

Filtering for "{{ .Title }}"

diff --git a/layouts/layouts/404.html b/layouts/layouts/404.html deleted file mode 100644 index 76d46d9..0000000 --- a/layouts/layouts/404.html +++ /dev/null @@ -1,29 +0,0 @@ -{{ define "title" }}404{{ end }} {{ define "main" }} - -
-

🏝️

-

OHHHHH~ -

-

Who lives in a pineapple under the sea?

-
-{{ end }} diff --git a/layouts/layouts/_default/_markup/render-image.html b/layouts/layouts/_default/_markup/render-image.html deleted file mode 100644 index bf19bf9..0000000 --- a/layouts/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{ .Text }} -
{{ .Text }}
-
\ No newline at end of file diff --git a/layouts/layouts/_default/baseof.html b/layouts/layouts/_default/baseof.html deleted file mode 100644 index 72b2954..0000000 --- a/layouts/layouts/_default/baseof.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - {{- partial "favicon.html" . -}} - {{ .Title }} - - {{- partial "seo_tags.html" . -}} - - - {{ with .OutputFormats.Get "rss" -}} {{ printf ` - - ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} {{- - partial "style.html" . -}} - - - {{- partial "custom_head.html" . -}} - - - -
{{- block "main" . }}{{- end }}
-
{{- partial "footer.html" . -}}
- - - {{- partial "custom_body.html" . -}} - - diff --git a/layouts/layouts/_default/list.html b/layouts/layouts/_default/list.html deleted file mode 100644 index 8c1db86..0000000 --- a/layouts/layouts/_default/list.html +++ /dev/null @@ -1,70 +0,0 @@ -{{ define "main" }} - - {{ if .Site.Params.postSearch }} - - - {{ end }} -
    - {{ $currentYear := 0 }} {{ range .Pages }} {{ if and (not .Params.hidden) - (not (in .Params.categories "往昔")) }} - -
  • - - - - - - {{ .Title }} -
  • - - {{ end }} {{ else }} -
  • No posts yet
  • - {{ end }} -
-
-{{ end }} diff --git a/layouts/layouts/_default/rss.xml b/layouts/layouts/_default/rss.xml deleted file mode 100644 index e480a4b..0000000 --- a/layouts/layouts/_default/rss.xml +++ /dev/null @@ -1,82 +0,0 @@ -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} -{{- end }} - -{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} -{{- end }} - -{{- $pctx := . }} -{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} -{{- $pages := slice }} -{{- if or $.IsHome $.IsSection }} -{{- $pages = where $pctx.RegularPages "Type" "in" (slice "posts" "post") }} -{{- else }} -{{- $pages = where $pctx.Pages "Type" "in" (slice "posts" "post") }} -{{- end }} - -{{- printf "" | safeHTML }} - - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo - {{ site.LanguageCode }} - {{ with $authorEmail }} - {{ . }}{{ with $authorName }} ({{ . }}){{ end }} - {{ end }} - {{ with $authorEmail }} - {{ . }}{{ with $authorName }} ({{ . }}){{ end }} - {{ end }} - {{ with .Site.Params.copyright }} - {{ . }} - {{ end }} - {{ if not .Date.IsZero }} - {{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ end }} - {{ if and .Site.Params.RSS.followFeedId .Site.Params.RSS.followUserId }} - - {{ .Site.Params.RSS.followFeedId }} - {{ .Site.Params.RSS.followUserId }} - - {{ end }} - {{- with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{- end }} - {{- range $pages }} - - {{ .Title }} - {{ .Permalink }} - {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} - {{ .Permalink }} - {{ .Content | transform.XMLEscape | safeHTML }} - - {{- end }} - - diff --git a/layouts/layouts/_default/single.html b/layouts/layouts/_default/single.html deleted file mode 100644 index 6b3f0a4..0000000 --- a/layouts/layouts/_default/single.html +++ /dev/null @@ -1,319 +0,0 @@ -{{ define "main" }} -
{{- partial "header.html" . -}}
- - - - -
- -{{ partial "post_meta.html" . }} - -{{ $upvoteEnabled := default .Site.Params.upvote .Params.upvote }} {{ if $upvoteEnabled }} -
- - - -
- - - -{{ end }} - - -{{ $tocEnabled := default .Site.Params.toc .Params.toc }} {{ if $tocEnabled }} -
{{ partial "toc.html" . }}
-{{ end }} - -{{ if .Params.comments | default true }} -
-
- -

评论 与 Webmentions

-
-
- -
-
- - -

- 若想回复本文,请在你的博客或社媒发布含有本文链接的帖子,然后在下方表单提交链接。 -

-
-
-
- - -
- - - -
-
-
-

- 也可以发送邮件评论。 -

- 关于 Webmention 的更多信息 - 以及 - 为什么要这么做? -
- - - - {{ end }} -
-
-
- - {{ if not .Params.comments }} - {{ with .Params.reason }} -
-

评论区已关闭。

- {{ . | markdownify }} -
- {{ end }} - {{ end }} -
-{{ end }} diff --git a/layouts/layouts/_default/term.html b/layouts/layouts/_default/term.html deleted file mode 100644 index 0d55fc1..0000000 --- a/layouts/layouts/_default/term.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ define "main" }} -
-

{{ .Title }}

- -
- {{ range .Pages }} - -
  • - - {{ .Title }} -
  • - - {{ else }} -

    该分类下还没有文章。

    - {{ end }} -
    -
    -{{ end }} diff --git a/layouts/layouts/archives/single.html b/layouts/layouts/archives/single.html deleted file mode 100644 index 698fc46..0000000 --- a/layouts/layouts/archives/single.html +++ /dev/null @@ -1,96 +0,0 @@ -{{ define "main" }} -
    {{- partial "header.html" . -}}
    - - {{ if .Site.Params.postSearch }} - - - {{ end }} {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} - {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }} - - {{ $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/layouts/index.html b/layouts/layouts/index.html deleted file mode 100644 index 2c47df5..0000000 --- a/layouts/layouts/index.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -
    {{- partial "header.html" . -}}
    -{{ .Content }} {{ end }} diff --git a/layouts/layouts/partials/custom_body.html b/layouts/layouts/partials/custom_body.html deleted file mode 100644 index 126375a..0000000 --- a/layouts/layouts/partials/custom_body.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/layouts/layouts/partials/custom_head.html b/layouts/layouts/partials/custom_head.html deleted file mode 100644 index 051d3d9..0000000 --- a/layouts/layouts/partials/custom_head.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - diff --git a/layouts/layouts/partials/favicon.html b/layouts/layouts/partials/favicon.html deleted file mode 100644 index ccf1a5d..0000000 --- a/layouts/layouts/partials/favicon.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ with .Site.Params.favicon }} -{{ end }} diff --git a/layouts/layouts/partials/footer.html b/layouts/layouts/partials/footer.html deleted file mode 100644 index 5cd0d54..0000000 --- a/layouts/layouts/partials/footer.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/layouts/layouts/partials/header.html b/layouts/layouts/partials/header.html deleted file mode 100644 index 1efdd22..0000000 --- a/layouts/layouts/partials/header.html +++ /dev/null @@ -1,4 +0,0 @@ - -

    {{ .Site.Title }}

    -
    - diff --git a/layouts/layouts/partials/nav.html b/layouts/layouts/partials/nav.html deleted file mode 100644 index 96bf26b..0000000 --- a/layouts/layouts/partials/nav.html +++ /dev/null @@ -1,6 +0,0 @@ -{{ range .Site.Menus.main }} -{{ .Name }} -{{ end }} -{{ with .Site.GetPage "/blog" }} -Blog -{{ end }} diff --git a/layouts/layouts/partials/post_meta.html b/layouts/layouts/partials/post_meta.html deleted file mode 100644 index 741efd2..0000000 --- a/layouts/layouts/partials/post_meta.html +++ /dev/null @@ -1,39 +0,0 @@ -{{ if ne (.Params.showMeta | default true) false }} - -{{ end }} diff --git a/layouts/layouts/partials/seo_tags.html b/layouts/layouts/partials/seo_tags.html deleted file mode 100644 index 06e90cd..0000000 --- a/layouts/layouts/partials/seo_tags.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - -{{ template "_internal/opengraph.html" . }} - - -{{ template "_internal/twitter_cards.html" . }} - - -{{ template "_internal/schema.html" . }} diff --git a/layouts/layouts/partials/style.html b/layouts/layouts/partials/style.html deleted file mode 100644 index 470a611..0000000 --- a/layouts/layouts/partials/style.html +++ /dev/null @@ -1,846 +0,0 @@ - diff --git a/layouts/layouts/partials/toc.html b/layouts/layouts/partials/toc.html deleted file mode 100644 index 66936a4..0000000 --- a/layouts/layouts/partials/toc.html +++ /dev/null @@ -1,91 +0,0 @@ -{{/* 根据页面内容生成目录 */}} -{{ if and .TableOfContents (ne .TableOfContents "") }} - - - -{{ end }} \ No newline at end of file diff --git a/layouts/layouts/robots.txt b/layouts/layouts/robots.txt deleted file mode 100644 index 0326f5c..0000000 --- a/layouts/layouts/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-Agent: * -Sitemap: {{ "sitemap.xml" | absURL }} diff --git a/layouts/layouts/shortcodes/archives-list.html b/layouts/layouts/shortcodes/archives-list.html deleted file mode 100644 index b9767f7..0000000 --- a/layouts/layouts/shortcodes/archives-list.html +++ /dev/null @@ -1,30 +0,0 @@ -{{ $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/layouts/shortcodes/book.html b/layouts/layouts/shortcodes/book.html deleted file mode 100644 index 45f806a..0000000 --- a/layouts/layouts/shortcodes/book.html +++ /dev/null @@ -1,9 +0,0 @@ -
    - {{ if .Get "url" }} - - 图书封面 - - {{ else }} - 图书封面 - {{ end }} -
    diff --git a/layouts/layouts/shortcodes/music.html b/layouts/layouts/shortcodes/music.html deleted file mode 100644 index 583b0b0..0000000 --- a/layouts/layouts/shortcodes/music.html +++ /dev/null @@ -1,37 +0,0 @@ - - -
    - -
    - Cover -
    -

    {{ .Get "title" }}

    -

    {{ .Get "artist" }}

    -
    -
    - - - -
    diff --git a/layouts/layouts/shortcodes/recent-posts.html b/layouts/layouts/shortcodes/recent-posts.html deleted file mode 100644 index b2a6637..0000000 --- a/layouts/layouts/shortcodes/recent-posts.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ -$recent := first 5 $pages.ByDate.Reverse }} - - - -
    - {{ if $recent }} {{ range $index, $page := $recent }} -
    -

    - {{ .Title }} -

    -
    {{ .Summary }}
    - - {{ partial "post_meta.html" . }} - - {{ if not (eq (add $index 1) (len $recent)) }} {{ end }} {{ end }} {{ else }} -
    暂无文章
    - {{ end }} -
    diff --git a/layouts/layouts/shortcodes/word-count.html b/layouts/layouts/shortcodes/word-count.html deleted file mode 100644 index 38dbe0e..0000000 --- a/layouts/layouts/shortcodes/word-count.html +++ /dev/null @@ -1,41 +0,0 @@ -{{ $scratch := newScratch }} {{ if eq (.Get 0) "posts" }} {{ range where -site.RegularPages "Type" "in" (slice "posts" "jottings" "readings" "tech") }} {{ -if not (in .Params.categories "!往昔!") }} {{ $scratch.Add "wordcount" .WordCount -}} {{ end }} {{ end }} {{ else if eq (.Get 0) "all" }} {{ range where -site.RegularPages "Type" "in" (slice "posts" "about" "newsgroup" "links" -"jottings" "readings" "tech") }} {{ if not (in .Params.categories "!往昔") }} {{ -$scratch.Add "wordcount" .WordCount }} {{ end }} {{ 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 }} diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html index 5d5c1ed..b3e5d2a 100644 --- a/layouts/partials/custom_head.html +++ b/layouts/partials/custom_head.html @@ -1,19 +1,7 @@ - - - diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 5cd0d54..69e3e66 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,8 +1,8 @@ diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index 1c180c3..1771751 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -1,33 +1,12 @@ {{ if ne (.Params.showMeta | default true) false }} {{ end }} - - diff --git a/layouts/partials/style.html b/layouts/partials/style.html deleted file mode 100644 index f314c0e..0000000 --- a/layouts/partials/style.html +++ /dev/null @@ -1,811 +0,0 @@ - diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 66936a4..101c5e9 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,91 +1,19 @@ -{{/* 根据页面内容生成目录 */}} -{{ if and .TableOfContents (ne .TableOfContents "") }} - - - -{{ end }} \ No newline at end of file +{{ $hasHeadings := false }} +{{ if .RawContent }} + {{/* 正则匹配:查找以 1 到 6 个 # 开头的行 */}} + {{ $headings := findRE "(?m)^#{1,6} " .RawContent }} + {{ if gt (len $headings) 0 }} + {{ $hasHeadings = true }} + {{ end }} +{{ end }} + +{{ if $hasHeadings }} + +{{ end }} diff --git a/layouts/shortcodes/archives-list.html b/layouts/shortcodes/archives-list.html index b9767f7..738e368 100644 --- a/layouts/shortcodes/archives-list.html +++ b/layouts/shortcodes/archives-list.html @@ -1,30 +1,35 @@ +
    + +

    {{ .Site.Title }}

    +
    + + +
    + {{ $allPages := where .Site.RegularPages "Type" "in" (slice "posts" "blog") }} -{{ $visiblePages := where $allPages "Params.hidden" "!=" true }} -{{ $pagesToShow := $visiblePages.ByDate.Reverse }} +{{ $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 }} -
    +

    归档

    + +

    共有 {{ len $pagesToShow }} 篇文章

    + +
      + {{ $currentYear := 0 }} {{ range $pagesToShow }} {{ $year := .Date.Year }} + {{ if ne $year $currentYear }} +

      {{ $year }}

      + {{ $currentYear = $year }} {{ end }} +
    • + + + + + + {{ .Title }} +
    • + {{ end }} +
    diff --git a/layouts/shortcodes/word-count.html b/layouts/shortcodes/word-count.html index 38dbe0e..20599f6 100644 --- a/layouts/shortcodes/word-count.html +++ b/layouts/shortcodes/word-count.html @@ -1,41 +1,29 @@ -{{ $scratch := newScratch }} {{ if eq (.Get 0) "posts" }} {{ range where -site.RegularPages "Type" "in" (slice "posts" "jottings" "readings" "tech") }} {{ -if not (in .Params.categories "!往昔!") }} {{ $scratch.Add "wordcount" .WordCount -}} {{ end }} {{ end }} {{ else if eq (.Get 0) "all" }} {{ range where -site.RegularPages "Type" "in" (slice "posts" "about" "newsgroup" "links" -"jottings" "readings" "tech") }} {{ if not (in .Params.categories "!往昔") }} {{ -$scratch.Add "wordcount" .WordCount }} {{ end }} {{ 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 }} +{{ $scratch := newScratch }} {{ $scope := .Get 0 | default "posts" }} {{ $pages +:= where site.RegularPages "Type" "in" (slice "posts" "jottings" "readings" +"tech") }} {{ if eq $scope "all" }} {{ $pages = where site.RegularPages "Type" +"in" (slice "posts" "about" "newsgroup" "links" "jottings" "readings" "tech") }} +{{ end }} {{ range $pages }} {{ if not (in .Params.categories "!往昔!") }} {{ +$scratch.Add "wordcount" .WordCount }} {{ end }} {{ end }} {{ $count := +$scratch.Get "wordcount" }} {{ if gt $count 0 }} +
    +

    + 共书写了 {{ lang.FormatNumber 0 $count }} 字,{{ $readTime + := div $count 400 }}预计需要阅读 + {{ if lt $readTime 60 }}{{ $readTime }} 分钟{{ else }}{{ div (float + $readTime) 60 | printf "%.1f" }} 小时{{ end }} + ,{{ $classics := slice (dict "name" "红楼梦" "words" 731017) (dict "name" + "金阁寺" "words" 125000) (dict "name" "了不起的盖茨比" "words" 49800) (dict + "name" "呐喊" "words" 152000) (dict "name" "老人与海" "words" 26800) (dict + "name" "1984" "words" 123000) (dict "name" "围城" "words" 257000) (dict + "name" "飘" "words" 802000) }} {{ $closestBook := index $classics 0 }} {{ + $minDiff := 99999999 }} {{ range $classics }} {{ $diff := sub $count .words + }}{{ if lt $diff 0 }}{{ $diff = mul $diff -1 }}{{ end }} {{ if lt $diff + $minDiff }} {{ $minDiff = $diff }} {{ $closestBook = . }} {{ end }} {{ end + }} {{ $ratio := div (float $count) $closestBook.words }}相当于写了 + {{ $ratio | printf "%.2f" }} 本《{{ $closestBook.name + }}》。 +

    +
    +{{ end }} -- cgit v1.2.3