summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-01-25 15:04:12 +0800
committerEltrac <hi@guhub.cn>2025-01-25 15:04:12 +0800
commitc656568251a9541358decac3e7deccb5a84b8a80 (patch)
tree8726804d8ef6b6260979ef8fdac49b0dce450805 /layouts
parent7e5fabaa4aeb07f40d2226947048a4850ab4d885 (diff)
chore: simplify calheatmap generation
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/index.calheatmap.json9
-rw-r--r--layouts/index.calheatmap.json15
2 files changed, 9 insertions, 15 deletions
diff --git a/layouts/_default/index.calheatmap.json b/layouts/_default/index.calheatmap.json
new file mode 100644
index 00000000..3b12b02f
--- /dev/null
+++ b/layouts/_default/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.calheatmap.json b/layouts/index.calheatmap.json
deleted file mode 100644
index 65b1d942..00000000
--- a/layouts/index.calheatmap.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{{- /* 设置 Content-Type 为 JSON */ -}}
-{{- $entries := slice -}}
-{{- range .Site.RegularPages -}}
- {{- $wordCount := .WordCount -}}
- {{- $date := .Date.Format "2006-01-02" -}}
- {{- $entry := dict "date" $date "value" $wordCount -}}
- {{- $entries = $entries | append $entry -}}
-{{- end -}}
-{{- $.Scratch.Add "results" $entries -}}
-[
- {{- range $i, $entry := $.Scratch.Get "results" -}}
- {{- if $i }},{{ end -}}
- {{- $entry | jsonify -}}
- {{- end -}}
-]