From 5d9cebc05cb64502230f57fb565bfc71af42d29b Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sat, 28 Jun 2025 15:52:57 +0800 Subject: refactor: stats page now uses partial components Extracted the site stats table and external link rank sections into separate partials (stats-table.html and external-link-rank.html) for better modularity and maintainability. Updated stats.html to use these new components and improved section structure. --- layouts/_default/stats.html | 156 ++++---------------------------------------- 1 file changed, 12 insertions(+), 144 deletions(-) (limited to 'layouts/_default/stats.html') diff --git a/layouts/_default/stats.html b/layouts/_default/stats.html index f8eff423..683b559d 100644 --- a/layouts/_default/stats.html +++ b/layouts/_default/stats.html @@ -1,128 +1,24 @@ {{ define "main" }} - -
{{ partial "header.html" . }} {{ partial "components/postnav.html" . }} -
- {{ .Content }} -
-

站点统计

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
页面总数{{ len .Site.RegularPages }}总字数 - - {{- $words := 0 -}} - {{- range .Site.RegularPages -}} - {{- $words = add $words .WordCount -}} - {{- end -}} - {{ $words }} - -
标签总数{{ len .Site.Taxonomies.tags }}专栏数量{{ len .Site.Taxonomies.categories }}
卡片数量{{ len (where .Site.RegularPages "Section" "cards") }}小说数量{{ len (where .Site.RegularPages "Section" "fictions") }}
书评数量{{ len (where .Site.RegularPages "Section" "library") }}精选文章数量{{ len (where .Site.RegularPages ".Params.featured" true) }}
+ {{ partial "components/stats-table" . }}
-

每月文章字数

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

每月文章字数

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

文章发布时间段分布

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

文章发布时间段分布

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

@@ -133,40 +29,12 @@ style="width:100%;height: 30rem;border-radius:5px;border:none">
-

外部链接排行

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

- - {{/* Find the maximum link count */}} - {{ $max := 0 }} - {{ range .Site.Data.externallinks }} - {{ if gt (index . 1) $max }} - {{ $max = index . 1 }} - {{ end }} - {{ end }} - - + {{ partial "components/external-link-rank" . }}
{{ partial "footer.html" . }} -- cgit v1.2.3