From 3cb68b6d5231ac9932b521dee767aae19ae1ca60 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Mon, 14 Jul 2025 19:05:44 +0800 Subject: refactor: keep layouts folder structure up to standards Former-commit-id: 44c7def3f6958550ccf965971f1819c1d6c514f1 --- layouts/_default/_markup/render-image.html | 16 ------ layouts/_default/_markup/render-link.html | 6 --- layouts/_default/_markup/render-table.html | 24 --------- layouts/_default/baseof.html | 15 ------ layouts/_default/featured.html | 43 ---------------- layouts/_default/index.calheatmap.json | 9 ---- layouts/_default/section.html | 53 ------------------- layouts/_default/single.html | 10 ---- layouts/_default/stats.html | 41 --------------- layouts/_default/taxonomy.html | 82 ------------------------------ layouts/_default/uncategorized.html | 29 ----------- layouts/_markup/render-image.html | 16 ++++++ layouts/_markup/render-link.html | 6 +++ layouts/_markup/render-table.html | 24 +++++++++ layouts/_shortcodes/aplayer.html | 9 ++++ layouts/_shortcodes/book.html | 17 +++++++ layouts/_shortcodes/bookcard.html | 28 ++++++++++ layouts/_shortcodes/callout.html | 6 +++ layouts/_shortcodes/card.html | 29 +++++++++++ layouts/_shortcodes/gallery.html | 3 ++ layouts/_shortcodes/img.html | 25 +++++++++ layouts/_shortcodes/link.html | 14 +++++ layouts/_shortcodes/postcount.html | 1 + layouts/_shortcodes/quotecard.html | 3 ++ layouts/_shortcodes/right.html | 1 + layouts/_shortcodes/sidenote.html | 4 ++ layouts/_shortcodes/wordcount.html | 5 ++ layouts/baseof.html | 15 ++++++ layouts/featured.html | 43 ++++++++++++++++ layouts/home.html | 81 +++++++++++++++++++++++++++++ layouts/index.calheatmap.json | 9 ++++ layouts/index.html | 81 ----------------------------- layouts/section.html | 53 +++++++++++++++++++ layouts/shortcodes/aplayer.html | 9 ---- layouts/shortcodes/book.html | 17 ------- layouts/shortcodes/bookcard.html | 28 ---------- layouts/shortcodes/callout.html | 6 --- layouts/shortcodes/card.html | 29 ----------- layouts/shortcodes/gallery.html | 3 -- layouts/shortcodes/img.html | 25 --------- layouts/shortcodes/link.html | 14 ----- layouts/shortcodes/postcount.html | 1 - layouts/shortcodes/quotecard.html | 3 -- layouts/shortcodes/right.html | 1 - layouts/shortcodes/sidenote.html | 4 -- layouts/shortcodes/wordcount.html | 5 -- layouts/single.html | 10 ++++ layouts/stats.html | 41 +++++++++++++++ layouts/taxonomy.html | 82 ++++++++++++++++++++++++++++++ layouts/uncategorized.html | 29 +++++++++++ 50 files changed, 554 insertions(+), 554 deletions(-) delete mode 100644 layouts/_default/_markup/render-image.html delete mode 100644 layouts/_default/_markup/render-link.html delete mode 100644 layouts/_default/_markup/render-table.html delete mode 100644 layouts/_default/baseof.html delete mode 100644 layouts/_default/featured.html delete mode 100644 layouts/_default/index.calheatmap.json delete mode 100644 layouts/_default/section.html delete mode 100644 layouts/_default/single.html delete mode 100644 layouts/_default/stats.html delete mode 100644 layouts/_default/taxonomy.html delete mode 100644 layouts/_default/uncategorized.html create mode 100644 layouts/_markup/render-image.html create mode 100644 layouts/_markup/render-link.html create mode 100644 layouts/_markup/render-table.html create mode 100644 layouts/_shortcodes/aplayer.html create mode 100644 layouts/_shortcodes/book.html create mode 100644 layouts/_shortcodes/bookcard.html create mode 100644 layouts/_shortcodes/callout.html create mode 100644 layouts/_shortcodes/card.html create mode 100644 layouts/_shortcodes/gallery.html create mode 100644 layouts/_shortcodes/img.html create mode 100644 layouts/_shortcodes/link.html create mode 100644 layouts/_shortcodes/postcount.html create mode 100644 layouts/_shortcodes/quotecard.html create mode 100644 layouts/_shortcodes/right.html create mode 100644 layouts/_shortcodes/sidenote.html create mode 100644 layouts/_shortcodes/wordcount.html create mode 100644 layouts/baseof.html create mode 100644 layouts/featured.html create mode 100644 layouts/home.html create mode 100644 layouts/index.calheatmap.json delete mode 100644 layouts/index.html create mode 100644 layouts/section.html delete mode 100644 layouts/shortcodes/aplayer.html delete mode 100644 layouts/shortcodes/book.html delete mode 100644 layouts/shortcodes/bookcard.html delete mode 100644 layouts/shortcodes/callout.html delete mode 100644 layouts/shortcodes/card.html delete mode 100644 layouts/shortcodes/gallery.html delete mode 100644 layouts/shortcodes/img.html delete mode 100644 layouts/shortcodes/link.html delete mode 100644 layouts/shortcodes/postcount.html delete mode 100644 layouts/shortcodes/quotecard.html delete mode 100644 layouts/shortcodes/right.html delete mode 100644 layouts/shortcodes/sidenote.html delete mode 100644 layouts/shortcodes/wordcount.html create mode 100644 layouts/single.html create mode 100644 layouts/stats.html create mode 100644 layouts/taxonomy.html create mode 100644 layouts/uncategorized.html diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html deleted file mode 100644 index 21e574af..00000000 --- a/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- $src := .Destination -}} -{{- $alt := .Text | default "" -}} -{{- $caption := .Title | default "" -}} - -
- {{ $alt }} - {{- if $caption }} -
-

{{ $caption | markdownify }}

-
- {{- end }} -
-
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html deleted file mode 100644 index 2e8d32f7..00000000 --- a/layouts/_default/_markup/render-link.html +++ /dev/null @@ -1,6 +0,0 @@ -{{ $url := .Destination | safeURL }} -{{ if or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") }} - {{ .Text }} -{{ else }} - {{ .Text }} -{{ end }} diff --git a/layouts/_default/_markup/render-table.html b/layouts/_default/_markup/render-table.html deleted file mode 100644 index 75196aeb..00000000 --- a/layouts/_default/_markup/render-table.html +++ /dev/null @@ -1,24 +0,0 @@ -
- - {{- if .THead }} - - {{- range .THead }} - - {{- range . }} - {{ .Text | safeHTML }} - {{- end }} - - {{- end }} - - {{- end }} - - {{- range .TBody }} - - {{- range . }} - {{ .Text | safeHTML }} - {{- end }} - - {{- end }} - -
-
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html deleted file mode 100644 index 8c3d74a8..00000000 --- a/layouts/_default/baseof.html +++ /dev/null @@ -1,15 +0,0 @@ - - -{{ partial "head.html" . }} - - {{ partial "components/svg-filters.html" . }} -
- {{ block "main" . }}{{ end }} -
- {{ partial "scripts.html" . }} - {{ partial "components/global-search" . }} - {{ if .Site.Params.extraBody }} - {{ .Site.Params.extraBody | safeHTML }} - {{ end }} - - diff --git a/layouts/_default/featured.html b/layouts/_default/featured.html deleted file mode 100644 index 86d5f53a..00000000 --- a/layouts/_default/featured.html +++ /dev/null @@ -1,43 +0,0 @@ -{{ define "main" }} -
- {{ partial "header.html" . }} - {{ partial "components/postnav.html" . }} - -
- {{ .Content }} -
- - - -
-{{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_default/index.calheatmap.json b/layouts/_default/index.calheatmap.json deleted file mode 100644 index 3b12b02f..00000000 --- a/layouts/_default/index.calheatmap.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - {{- range $i, $page := .Site.RegularPages -}} - {{- if $i }},{{ end -}} - { - "date": "{{ $page.Date.Format "2006-01-02" }}", - "value": {{ $page.WordCount }} - } - {{- end -}} -] diff --git a/layouts/_default/section.html b/layouts/_default/section.html deleted file mode 100644 index c051990e..00000000 --- a/layouts/_default/section.html +++ /dev/null @@ -1,53 +0,0 @@ -{{ define "main" }} -
- {{ partial "header.html" . }} -
- - {{ $remainingMonthsToOpen := 3 }} - {{ range (where site.RegularPages "Type" "eq" "posts").GroupByDate "2006" -}} -
-

- {{ .Key }} - {{ T "archivePage.postCountAnnual" (len .Pages) }} -

- - {{ range .Pages.GroupByDate "January" }} -
- -

- {{ .Key }} - {{ T "archivePage.postCountMonthly" (len .Pages) }} -

-
-
-
    - {{ range .Pages }} -
  • -
    - - - {{ .Title }} - -
    -
    - {{ with .Params.categories }} - - {{ . }} - - {{ end }} -
    -
  • - {{ end }} -
-
-
- {{ $remainingMonthsToOpen = sub $remainingMonthsToOpen 1 }} - {{ end }} -
- {{ end }} -
-
- {{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html deleted file mode 100644 index 7f33f13b..00000000 --- a/layouts/_default/single.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ define "main" }} - {{ partial "header.html" . }} -
-
- {{ .Content }} -
-
- {{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_default/stats.html b/layouts/_default/stats.html deleted file mode 100644 index 683b559d..00000000 --- a/layouts/_default/stats.html +++ /dev/null @@ -1,41 +0,0 @@ -{{ define "main" }} -
- {{ partial "header.html" . }} - {{ partial "components/postnav.html" . }} - -
-

站点统计

- {{ partial "components/stats-table" . }} -
- -
-

每月文章字数

- {{ partial "components/word-count-chart" . }} -
- -
-

文章发布时间段分布

-
- {{ partial "components/publish-time-chart" . }} -
-
-
- -
-

内部链接图谱

-

站内各个页面之间通过超链接建立起来的联系,你可以通过视觉化的双向链接逛逛我的博客。图谱可以缩放和拖拽,你也可以点击这里全屏浏览。

-
- -
-
-
- -
-

外部链接排行

-

我在页面中嵌入的外部链接主要来自以下域名,引用次数少于 3 的已被排除。

- {{ partial "components/external-link-rank" . }} -
-
- {{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html deleted file mode 100644 index ef8f515f..00000000 --- a/layouts/_default/taxonomy.html +++ /dev/null @@ -1,82 +0,0 @@ -{{ define "main" }} -
- {{ partial "header.html" . }} - {{ partial "components/postnav.html" . }} - - -
- {{ $categorizedTags := dict }} - {{ $uncategorizedTags := slice }} - - - {{ range $tagName, $tagPages := .Site.Taxonomies.tags }} - {{ $tagPage := site.GetPage (printf "/tags/%s" $tagName) }} - {{ $tagData := dict "Name" $tagName "Count" (len $tagPages) "Page" $tagPage }} - {{ if $tagPage.Params.category }} - {{ $category := $tagPage.Params.category }} - {{ $categoryTags := index $categorizedTags $category | default slice }} - {{ $categoryTags = $categoryTags | append $tagData }} - {{ $categorizedTags = merge $categorizedTags (dict $category $categoryTags) }} - {{ else }} - {{ $uncategorizedTags = $uncategorizedTags | append $tagData }} - {{ end }} - {{ end }} - - - {{ $uncategorizedTags = sort $uncategorizedTags "Count" "desc" }} - {{ range $category, $categoryTags := $categorizedTags }} - {{ $categorizedTags = merge $categorizedTags (dict $category (sort $categoryTags "Count" "desc")) }} - {{ end }} - - - {{ if $uncategorizedTags }} - - {{ end }} - - - {{ range $category, $categoryTags := $categorizedTags }} - - {{ end }} -
-
-{{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_default/uncategorized.html b/layouts/_default/uncategorized.html deleted file mode 100644 index d29fa2e8..00000000 --- a/layouts/_default/uncategorized.html +++ /dev/null @@ -1,29 +0,0 @@ -{{ define "main" }} -
- {{ partial "components/post-page-header.html" . }} - {{ partial "components/breadcrumbs.html" . }} -
-

{{ .Content }}

-
- - {{ $uncategorized := where (where .Site.RegularPages "Section" "posts") "Params.categories" "==" nil }} - {{ if $uncategorized }} -
-
    - {{ range $uncategorized }} -
  1. - - {{ .Title }}{{ with .Params.subtitle }}:{{. }} - {{ end }} - - -
  2. - {{ end }} -
-
- {{ end }} -
-{{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/_markup/render-image.html b/layouts/_markup/render-image.html new file mode 100644 index 00000000..21e574af --- /dev/null +++ b/layouts/_markup/render-image.html @@ -0,0 +1,16 @@ +{{- $src := .Destination -}} +{{- $alt := .Text | default "" -}} +{{- $caption := .Title | default "" -}} + +
+ {{ $alt }} + {{- if $caption }} +
+

{{ $caption | markdownify }}

+
+ {{- end }} +
+
diff --git a/layouts/_markup/render-link.html b/layouts/_markup/render-link.html new file mode 100644 index 00000000..2e8d32f7 --- /dev/null +++ b/layouts/_markup/render-link.html @@ -0,0 +1,6 @@ +{{ $url := .Destination | safeURL }} +{{ if or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") }} + {{ .Text }} +{{ else }} + {{ .Text }} +{{ end }} diff --git a/layouts/_markup/render-table.html b/layouts/_markup/render-table.html new file mode 100644 index 00000000..75196aeb --- /dev/null +++ b/layouts/_markup/render-table.html @@ -0,0 +1,24 @@ +
+ + {{- if .THead }} + + {{- range .THead }} + + {{- range . }} + {{ .Text | safeHTML }} + {{- end }} + + {{- end }} + + {{- end }} + + {{- range .TBody }} + + {{- range . }} + {{ .Text | safeHTML }} + {{- end }} + + {{- end }} + +
+
diff --git a/layouts/_shortcodes/aplayer.html b/layouts/_shortcodes/aplayer.html new file mode 100644 index 00000000..84c83002 --- /dev/null +++ b/layouts/_shortcodes/aplayer.html @@ -0,0 +1,9 @@ +
diff --git a/layouts/_shortcodes/book.html b/layouts/_shortcodes/book.html new file mode 100644 index 00000000..6cb0c8e8 --- /dev/null +++ b/layouts/_shortcodes/book.html @@ -0,0 +1,17 @@ +
+
+ + + +
+
+
+

{{ .Get "title" }}

+

分数:{{ .Get "rating" }}

+
+
+ + {{ .Inner | markdownify }} +
+
+
diff --git a/layouts/_shortcodes/bookcard.html b/layouts/_shortcodes/bookcard.html new file mode 100644 index 00000000..27d96001 --- /dev/null +++ b/layouts/_shortcodes/bookcard.html @@ -0,0 +1,28 @@ +{{- $books := where .Site.Pages "Section" "library" -}} +{{- $book := index (where $books "File.BaseFileName" (.Get 0)) 0 -}} + +{{- if $book }} +
+
+ +
+

+ {{ $book.Title }} +

+ + {{- $rating := $book.Params.rating -}} + {{- $fullStars := math.Floor $rating -}} +
+ 评分: + {{- range seq $fullStars }} + ★ + {{- end -}} +
+ +
+ {{ $book.Content }} +
+
+{{- else }} +

⚠️ 无法找到书评: {{ .Get 0 }}

+{{- end }} diff --git a/layouts/_shortcodes/callout.html b/layouts/_shortcodes/callout.html new file mode 100644 index 00000000..62112390 --- /dev/null +++ b/layouts/_shortcodes/callout.html @@ -0,0 +1,6 @@ +
+
{{ index .Params 1 }}
+
+ {{ index .Params 0 | markdownify }} +
+
\ No newline at end of file diff --git a/layouts/_shortcodes/card.html b/layouts/_shortcodes/card.html new file mode 100644 index 00000000..a860b72c --- /dev/null +++ b/layouts/_shortcodes/card.html @@ -0,0 +1,29 @@ +{{- $card := .Site.GetPage (printf "cards/%s" (.Get 0)) -}} +{{- $hideHeader := .Get 1 | default "false" | lower -}} + +{{- if $card }} +
+ + + {{- if ne $hideHeader "true" }} +
+

{{ $card.Title }}

+ {{- if $card.Params.tags }} +

+ {{- range $card.Params.tags }} + #{{ . }} + {{- end }} +

+ {{- end }} +
+ {{- end }} + +
+ {{- with $card.Content }} + {{ . }} + {{- end }} +
+
+{{- else }} +

⚠️ 无法找到卡片: {{ .Get 0 }}

+{{- end }} diff --git a/layouts/_shortcodes/gallery.html b/layouts/_shortcodes/gallery.html new file mode 100644 index 00000000..ce456e05 --- /dev/null +++ b/layouts/_shortcodes/gallery.html @@ -0,0 +1,3 @@ +
+ {{ .Inner | markdownify | safeHTML }} +
diff --git a/layouts/_shortcodes/img.html b/layouts/_shortcodes/img.html new file mode 100644 index 00000000..01d0684b --- /dev/null +++ b/layouts/_shortcodes/img.html @@ -0,0 +1,25 @@ + +
+{{ with .Get "link" }}{{ end }} + + + + {{ if .Get "link" }}{{ end }} + {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }} +
{{ if isset .Params "title" }} +

{{ .Get "title" | markdownify }}

{{ end }} + {{ if or (.Get "caption") (.Get "attr") }}

+ {{ .Get "caption" }} + {{ with .Get "attrlink" }} {{ end }} + {{ .Get "attr" }} + {{ if .Get "attrlink" }} {{ end }} +

{{ end }} +
+{{ end }} +
+ diff --git a/layouts/_shortcodes/link.html b/layouts/_shortcodes/link.html new file mode 100644 index 00000000..1b9c4f79 --- /dev/null +++ b/layouts/_shortcodes/link.html @@ -0,0 +1,14 @@ + + {{ if and (isset .Params "image") .Params.image }} + + {{ end }} + {{ if ne (.Get "type") "podcast" }} + + {{ end }} + 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/quotecard.html b/layouts/_shortcodes/quotecard.html new file mode 100644 index 00000000..dfaf04e2 --- /dev/null +++ b/layouts/_shortcodes/quotecard.html @@ -0,0 +1,3 @@ +
+ {{ .Inner | markdownify }} +
\ No newline at end of file diff --git a/layouts/_shortcodes/right.html b/layouts/_shortcodes/right.html new file mode 100644 index 00000000..775dcc04 --- /dev/null +++ b/layouts/_shortcodes/right.html @@ -0,0 +1 @@ +

{{ index .Params 0 | markdownify }}

diff --git a/layouts/_shortcodes/sidenote.html b/layouts/_shortcodes/sidenote.html new file mode 100644 index 00000000..bf2a87d3 --- /dev/null +++ b/layouts/_shortcodes/sidenote.html @@ -0,0 +1,4 @@ +
+

{{ index .Params 0 | markdownify }}

+
{{ index .Params 1 | markdownify }}
+
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 }} diff --git a/layouts/baseof.html b/layouts/baseof.html new file mode 100644 index 00000000..8c3d74a8 --- /dev/null +++ b/layouts/baseof.html @@ -0,0 +1,15 @@ + + +{{ partial "head.html" . }} + + {{ partial "components/svg-filters.html" . }} +
+ {{ block "main" . }}{{ end }} +
+ {{ partial "scripts.html" . }} + {{ partial "components/global-search" . }} + {{ if .Site.Params.extraBody }} + {{ .Site.Params.extraBody | safeHTML }} + {{ end }} + + diff --git a/layouts/featured.html b/layouts/featured.html new file mode 100644 index 00000000..86d5f53a --- /dev/null +++ b/layouts/featured.html @@ -0,0 +1,43 @@ +{{ define "main" }} +
+ {{ partial "header.html" . }} + {{ partial "components/postnav.html" . }} + +
+ {{ .Content }} +
+ + + +
+{{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/home.html b/layouts/home.html new file mode 100644 index 00000000..cc1042fd --- /dev/null +++ b/layouts/home.html @@ -0,0 +1,81 @@ +{{ define "main" }} +
+ {{ partial "header.html" . }} + {{ partial "components/postnav.html" . }} + + +
+
+ {{ $firstPost := true }} + {{ range first 8 (where site.RegularPages "Type" "in" site.Params.mainSections) }} +
+
+
+

+ + in {{ .Section }} +

+

+ + {{ if eq .Section "library" }} + 读《{{ .Title }}》 + {{ else }} + {{ .Title }} + {{ end }} + + {{ if eq .Section "fictions" }} + 小说 + {{ end }} +

+
+ {{ with .Params.categories }} + + {{ end }} +
+ + {{ if $firstPost }} +
+ {{ .Summary }} +
+ {{ $firstPost = false }} + {{ end }} +
+ {{ end }} +
+ + {{ T "moreLinks.posts" }} + +
+ + {{ if eq .Site.Language.Lang "zh" }} + +
+
+ {{- $cards := .Site.GetPage "section" "cards" }} + {{- $paginator := .Paginate $cards.Pages 4 }} + {{- range $paginator.Pages }} + {{ partial "items/card" (dict "context" . "summary" true) }} + {{- end }} +
+
+ + {{ T "moreLinks.cards" }} + +
+
+ {{ end }} +
+{{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/index.calheatmap.json b/layouts/index.calheatmap.json new file mode 100644 index 00000000..3b12b02f --- /dev/null +++ b/layouts/index.calheatmap.json @@ -0,0 +1,9 @@ +[ + {{- range $i, $page := .Site.RegularPages -}} + {{- if $i }},{{ end -}} + { + "date": "{{ $page.Date.Format "2006-01-02" }}", + "value": {{ $page.WordCount }} + } + {{- end -}} +] diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index cc1042fd..00000000 --- a/layouts/index.html +++ /dev/null @@ -1,81 +0,0 @@ -{{ define "main" }} -
- {{ partial "header.html" . }} - {{ partial "components/postnav.html" . }} - - -
-
- {{ $firstPost := true }} - {{ range first 8 (where site.RegularPages "Type" "in" site.Params.mainSections) }} -
-
-
-

- - in {{ .Section }} -

-

- - {{ if eq .Section "library" }} - 读《{{ .Title }}》 - {{ else }} - {{ .Title }} - {{ end }} - - {{ if eq .Section "fictions" }} - 小说 - {{ end }} -

-
- {{ with .Params.categories }} - - {{ end }} -
- - {{ if $firstPost }} -
- {{ .Summary }} -
- {{ $firstPost = false }} - {{ end }} -
- {{ end }} -
- - {{ T "moreLinks.posts" }} - -
- - {{ if eq .Site.Language.Lang "zh" }} - -
-
- {{- $cards := .Site.GetPage "section" "cards" }} - {{- $paginator := .Paginate $cards.Pages 4 }} - {{- range $paginator.Pages }} - {{ partial "items/card" (dict "context" . "summary" true) }} - {{- end }} -
-
- - {{ T "moreLinks.cards" }} - -
-
- {{ end }} -
-{{ partial "footer.html" . }} -{{ end }} diff --git a/layouts/section.html b/layouts/section.html new file mode 100644 index 00000000..c051990e --- /dev/null +++ b/layouts/section.html @@ -0,0 +1,53 @@ +{{ define "main" }} +
+ {{ partial "header.html" . }} +
+ + {{ $remainingMonthsToOpen := 3 }} + {{ range (where site.RegularPages "Type" "eq" "posts").GroupByDate "2006" -}} +
+

+ {{ .Key }} + {{ T "archivePage.postCountAnnual" (len .Pages) }} +

+ + {{ range .Pages.GroupByDate "January" }} +
+ +

+ {{ .Key }} + {{ T "archivePage.postCountMonthly" (len .Pages) }} +

+
+
+
    + {{ range .Pages }} +
  • +
    + + + {{ .Title }} + +
    +
    + {{ with .Params.categories }} + + {{ . }} + + {{ end }} +
    +
  • + {{ end }} +
+
+
+ {{ $remainingMonthsToOpen = sub $remainingMonthsToOpen 1 }} + {{ end }} +
+ {{ end }} +
+
+ {{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/shortcodes/aplayer.html b/layouts/shortcodes/aplayer.html deleted file mode 100644 index 84c83002..00000000 --- a/layouts/shortcodes/aplayer.html +++ /dev/null @@ -1,9 +0,0 @@ -
diff --git a/layouts/shortcodes/book.html b/layouts/shortcodes/book.html deleted file mode 100644 index 6cb0c8e8..00000000 --- a/layouts/shortcodes/book.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- - - -
-
-
-

{{ .Get "title" }}

-

分数:{{ .Get "rating" }}

-
-
- - {{ .Inner | markdownify }} -
-
-
diff --git a/layouts/shortcodes/bookcard.html b/layouts/shortcodes/bookcard.html deleted file mode 100644 index 27d96001..00000000 --- a/layouts/shortcodes/bookcard.html +++ /dev/null @@ -1,28 +0,0 @@ -{{- $books := where .Site.Pages "Section" "library" -}} -{{- $book := index (where $books "File.BaseFileName" (.Get 0)) 0 -}} - -{{- if $book }} -
-
- -
-

- {{ $book.Title }} -

- - {{- $rating := $book.Params.rating -}} - {{- $fullStars := math.Floor $rating -}} -
- 评分: - {{- range seq $fullStars }} - ★ - {{- end -}} -
- -
- {{ $book.Content }} -
-
-{{- else }} -

⚠️ 无法找到书评: {{ .Get 0 }}

-{{- end }} diff --git a/layouts/shortcodes/callout.html b/layouts/shortcodes/callout.html deleted file mode 100644 index 62112390..00000000 --- a/layouts/shortcodes/callout.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
{{ index .Params 1 }}
-
- {{ index .Params 0 | markdownify }} -
-
\ No newline at end of file diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html deleted file mode 100644 index a860b72c..00000000 --- a/layouts/shortcodes/card.html +++ /dev/null @@ -1,29 +0,0 @@ -{{- $card := .Site.GetPage (printf "cards/%s" (.Get 0)) -}} -{{- $hideHeader := .Get 1 | default "false" | lower -}} - -{{- if $card }} -
- - - {{- if ne $hideHeader "true" }} -
-

{{ $card.Title }}

- {{- if $card.Params.tags }} -

- {{- range $card.Params.tags }} - #{{ . }} - {{- end }} -

- {{- end }} -
- {{- end }} - -
- {{- with $card.Content }} - {{ . }} - {{- end }} -
-
-{{- else }} -

⚠️ 无法找到卡片: {{ .Get 0 }}

-{{- end }} diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html deleted file mode 100644 index ce456e05..00000000 --- a/layouts/shortcodes/gallery.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ .Inner | markdownify | safeHTML }} -
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html deleted file mode 100644 index 01d0684b..00000000 --- a/layouts/shortcodes/img.html +++ /dev/null @@ -1,25 +0,0 @@ - -
-{{ with .Get "link" }}{{ end }} - - - - {{ if .Get "link" }}{{ end }} - {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }} -
{{ if isset .Params "title" }} -

{{ .Get "title" | markdownify }}

{{ end }} - {{ if or (.Get "caption") (.Get "attr") }}

- {{ .Get "caption" }} - {{ with .Get "attrlink" }} {{ end }} - {{ .Get "attr" }} - {{ if .Get "attrlink" }} {{ end }} -

{{ end }} -
-{{ end }} -
- diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html deleted file mode 100644 index 1b9c4f79..00000000 --- a/layouts/shortcodes/link.html +++ /dev/null @@ -1,14 +0,0 @@ - - {{ if and (isset .Params "image") .Params.image }} - - {{ end }} - {{ if ne (.Get "type") "podcast" }} - - {{ end }} - diff --git a/layouts/shortcodes/postcount.html b/layouts/shortcodes/postcount.html deleted file mode 100644 index 68da6893..00000000 --- a/layouts/shortcodes/postcount.html +++ /dev/null @@ -1 +0,0 @@ -{{ len (where .Site.RegularPages "Section" "posts") }} diff --git a/layouts/shortcodes/quotecard.html b/layouts/shortcodes/quotecard.html deleted file mode 100644 index dfaf04e2..00000000 --- a/layouts/shortcodes/quotecard.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ .Inner | markdownify }} -
\ No newline at end of file diff --git a/layouts/shortcodes/right.html b/layouts/shortcodes/right.html deleted file mode 100644 index 775dcc04..00000000 --- a/layouts/shortcodes/right.html +++ /dev/null @@ -1 +0,0 @@ -

{{ index .Params 0 | markdownify }}

diff --git a/layouts/shortcodes/sidenote.html b/layouts/shortcodes/sidenote.html deleted file mode 100644 index bf2a87d3..00000000 --- a/layouts/shortcodes/sidenote.html +++ /dev/null @@ -1,4 +0,0 @@ -
-

{{ index .Params 0 | markdownify }}

-
{{ index .Params 1 | markdownify }}
-
diff --git a/layouts/shortcodes/wordcount.html b/layouts/shortcodes/wordcount.html deleted file mode 100644 index 3b302b82..00000000 --- a/layouts/shortcodes/wordcount.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ $total := 0 }} -{{ range where .Site.RegularPages "Section" "posts" }} - {{ $total = add $total .WordCount }} -{{ end }} -{{ $total }} diff --git a/layouts/single.html b/layouts/single.html new file mode 100644 index 00000000..7f33f13b --- /dev/null +++ b/layouts/single.html @@ -0,0 +1,10 @@ +{{ define "main" }} + {{ partial "header.html" . }} +
+
+ {{ .Content }} +
+
+ {{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/stats.html b/layouts/stats.html new file mode 100644 index 00000000..683b559d --- /dev/null +++ b/layouts/stats.html @@ -0,0 +1,41 @@ +{{ define "main" }} +
+ {{ partial "header.html" . }} + {{ partial "components/postnav.html" . }} + +
+

站点统计

+ {{ partial "components/stats-table" . }} +
+ +
+

每月文章字数

+ {{ partial "components/word-count-chart" . }} +
+ +
+

文章发布时间段分布

+
+ {{ partial "components/publish-time-chart" . }} +
+
+
+ +
+

内部链接图谱

+

站内各个页面之间通过超链接建立起来的联系,你可以通过视觉化的双向链接逛逛我的博客。图谱可以缩放和拖拽,你也可以点击这里全屏浏览。

+
+ +
+
+
+ +
+

外部链接排行

+

我在页面中嵌入的外部链接主要来自以下域名,引用次数少于 3 的已被排除。

+ {{ partial "components/external-link-rank" . }} +
+
+ {{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html new file mode 100644 index 00000000..ef8f515f --- /dev/null +++ b/layouts/taxonomy.html @@ -0,0 +1,82 @@ +{{ define "main" }} +
+ {{ partial "header.html" . }} + {{ partial "components/postnav.html" . }} + + +
+ {{ $categorizedTags := dict }} + {{ $uncategorizedTags := slice }} + + + {{ range $tagName, $tagPages := .Site.Taxonomies.tags }} + {{ $tagPage := site.GetPage (printf "/tags/%s" $tagName) }} + {{ $tagData := dict "Name" $tagName "Count" (len $tagPages) "Page" $tagPage }} + {{ if $tagPage.Params.category }} + {{ $category := $tagPage.Params.category }} + {{ $categoryTags := index $categorizedTags $category | default slice }} + {{ $categoryTags = $categoryTags | append $tagData }} + {{ $categorizedTags = merge $categorizedTags (dict $category $categoryTags) }} + {{ else }} + {{ $uncategorizedTags = $uncategorizedTags | append $tagData }} + {{ end }} + {{ end }} + + + {{ $uncategorizedTags = sort $uncategorizedTags "Count" "desc" }} + {{ range $category, $categoryTags := $categorizedTags }} + {{ $categorizedTags = merge $categorizedTags (dict $category (sort $categoryTags "Count" "desc")) }} + {{ end }} + + + {{ if $uncategorizedTags }} + + {{ end }} + + + {{ range $category, $categoryTags := $categorizedTags }} + + {{ end }} +
+
+{{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/uncategorized.html b/layouts/uncategorized.html new file mode 100644 index 00000000..d29fa2e8 --- /dev/null +++ b/layouts/uncategorized.html @@ -0,0 +1,29 @@ +{{ define "main" }} +
+ {{ partial "components/post-page-header.html" . }} + {{ partial "components/breadcrumbs.html" . }} +
+

{{ .Content }}

+
+ + {{ $uncategorized := where (where .Site.RegularPages "Section" "posts") "Params.categories" "==" nil }} + {{ if $uncategorized }} +
+
    + {{ range $uncategorized }} +
  1. + + {{ .Title }}{{ with .Params.subtitle }}:{{. }} + {{ end }} + + +
  2. + {{ end }} +
+
+ {{ end }} +
+{{ partial "footer.html" . }} +{{ end }} -- cgit v1.2.3