diff options
| author | Eltrac <hi@guhub.cn> | 2025-01-25 15:04:12 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-01-25 15:04:12 +0800 |
| commit | 9d21bb49342c28668a120156ab240ffca0e4fac9 (patch) | |
| tree | 8a73042d45a09dac1511e2be2a34083d9adbdcd0 | |
| parent | 589fe2fad241e98fd939b17a49720b9be22d3c4f (diff) | |
chore: simplify calheatmap generation
Former-commit-id: c656568251a9541358decac3e7deccb5a84b8a80
| -rw-r--r-- | layouts/_default/index.calheatmap.json | 9 | ||||
| -rw-r--r-- | layouts/index.calheatmap.json | 15 |
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 -}} -] |
