Skip to content

Commit

Permalink
Display wordCount in the title.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsayleung committed Sep 5, 2024
1 parent b29c441 commit 6effe9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion layouts/shortcodes/heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@
hideDelay: 1000,
enterable: true,
formatter: function (params) {
const thousandWordsText = {{ .Get "language" }} === "EN" ? 'k words': '千字';
const thousandWords = (params.data[1]/1000.0).toFixed(1);
const date = params.data[0];
const posts = postsByDate.get(date).get("posts");
var content = `${date}`;
for (const [i, post] of posts.entries()) {
content += "<br>";
var link = post.get("link");
var title = post.get("title");
content += `<a href="${link}" target="_blank">${title}</a>`
content += `<a href="${link}" target="_blank">${title} | ${thousandWords}${thousandWordsText}</a>`
}
return content;
}
Expand Down

0 comments on commit 6effe9b

Please sign in to comment.