Skip to content

Commit

Permalink
Add default value for shortcode heatmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsayleung committed Sep 5, 2024
1 parent 6effe9b commit f533eb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion content/en/about_me.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lastmod = 2022-02-23T17:23:37+08:00
draft = false
+++

{{< heatmap title_text="Article Activity" language="EN">}}
{{< heatmap >}}

## About me {#about-me}

Expand Down
8 changes: 4 additions & 4 deletions layouts/shortcodes/heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div style="display: flex; justify-content: center; align-items: center">
<p style="margin-right: 15px; margin-bottom: 0; color: #333; padding: 8px">
{{ .Get "title_text" }}
{{ default "Article Activity" (.Get "title_text") }}
</p>
<select
id="yearSelector"
Expand Down Expand Up @@ -128,10 +128,10 @@
yearLabel: { show: false },
dayLabel: {
firstDay: 1,
nameMap: {{ .Get "language" }}
nameMap: {{ default "EN" (.Get "language")}}
},
monthLabel: {
nameMap: {{ .Get "language" }}
nameMap: {{ default "EN" (.Get "language")}}
},
splitLine: {
show: false,
Expand All @@ -141,7 +141,7 @@
hideDelay: 1000,
enterable: true,
formatter: function (params) {
const thousandWordsText = {{ .Get "language" }} === "EN" ? 'k words': '千字';
const thousandWordsText = {{ default "EN" (.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");
Expand Down

0 comments on commit f533eb2

Please sign in to comment.