Skip to content

Commit 9b21c4c

Browse files
committed
Fix the word count problem, which was counted by date, should be counted by posts instead
1 parent 1aceb8f commit 9b21c4c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

layouts/shortcodes/heatmap.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
var postObj = new Map();
7676
postObj.set("title", {{ .Title }});
7777
postObj.set("link", {{ .RelPermalink }});
78+
postObj.set("wordCount", {{ .WordCount }});
7879
var wordCount = {{ .WordCount }};
7980
var data = postsByDate.get(date);
8081
if (data === undefined) {
@@ -168,14 +169,14 @@
168169
enterable: true,
169170
formatter: function (params) {
170171
const thousandWordsText = {{ default "EN" (.Get "language")}} === "EN" ? 'k words': '千字';
171-
const thousandWords = (params.data[1]/1000.0).toFixed(1);
172172
const date = params.data[0];
173173
const posts = postsByDate.get(date).get("posts");
174174
var content = `${date}`;
175175
for (const [i, post] of posts.entries()) {
176176
content += "<br>";
177177
var link = post.get("link");
178178
var title = post.get("title");
179+
const thousandWords = (post.get("wordCount")/1000.0).toFixed(1);
179180
content += `<a href="${link}" target="_blank">${title} | ${thousandWords}${thousandWordsText}</a>`
180181
}
181182
return content;

0 commit comments

Comments
 (0)