Skip to content

Commit f533eb2

Browse files
committed
Add default value for shortcode heatmap.
1 parent 6effe9b commit f533eb2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

content/en/about_me.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ lastmod = 2022-02-23T17:23:37+08:00
55
draft = false
66
+++
77

8-
{{< heatmap title_text="Article Activity" language="EN">}}
8+
{{< heatmap >}}
99

1010
## About me {#about-me}
1111

layouts/shortcodes/heatmap.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div style="display: flex; justify-content: center; align-items: center">
44
<p style="margin-right: 15px; margin-bottom: 0; color: #333; padding: 8px">
5-
{{ .Get "title_text" }}
5+
{{ default "Article Activity" (.Get "title_text") }}
66
</p>
77
<select
88
id="yearSelector"
@@ -128,10 +128,10 @@
128128
yearLabel: { show: false },
129129
dayLabel: {
130130
firstDay: 1,
131-
nameMap: {{ .Get "language" }}
131+
nameMap: {{ default "EN" (.Get "language")}}
132132
},
133133
monthLabel: {
134-
nameMap: {{ .Get "language" }}
134+
nameMap: {{ default "EN" (.Get "language")}}
135135
},
136136
splitLine: {
137137
show: false,
@@ -141,7 +141,7 @@
141141
hideDelay: 1000,
142142
enterable: true,
143143
formatter: function (params) {
144-
const thousandWordsText = {{ .Get "language" }} === "EN" ? 'k words': '千字';
144+
const thousandWordsText = {{ default "EN" (.Get "language")}} === "EN" ? 'k words': '千字';
145145
const thousandWords = (params.data[1]/1000.0).toFixed(1);
146146
const date = params.data[0];
147147
const posts = postsByDate.get(date).get("posts");

0 commit comments

Comments
 (0)