Skip to content

Commit 6bd0c15

Browse files
committed
fix template render error by GitInfo nil
1 parent 36f36af commit 6bd0c15

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

themes/hugo-coder/layouts/dev/single.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ <h1 class="title">{{ .Title }}</h1>
4444
{{ $outContent := .Content | replaceRE $PATTERN_EMPTY_ALT $REPLACEMENT | replaceRE $PATTERN_ALT $REPLACEMENT | safeHTML }}
4545
{{ $outContent }}
4646

47+
{{ if .GitInfo }}
4748
<div style="color: #5c7080;font-size: small;font-style: italic;">
4849
更新时间:
4950
<!-- Calculate the age in days and months -->
@@ -61,6 +62,7 @@ <h1 class="title">{{ .Title }}</h1>
6162
{{ end }}
6263
版本: <a href="https://github.com/madawei2699/bmpi.dev/commit/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a>
6364
</div>
65+
{{ end }}
6466

6567
<div style="text-align: center;color: darkgray;">
6668
{{ if eq .Site.Language.Lang "zh-cn" }}

themes/hugo-coder/layouts/money/single.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ <h1 class="title">{{ .Title }}</h1>
4444
{{ $outContent := .Content | replaceRE $PATTERN_EMPTY_ALT $REPLACEMENT | replaceRE $PATTERN_ALT $REPLACEMENT | safeHTML }}
4545
{{ $outContent }}
4646

47+
{{ if .GitInfo }}
4748
<div style="color: #5c7080;font-size: small;font-style: italic;">
4849
更新时间:
4950
<!-- Calculate the age in days and months -->
@@ -61,6 +62,7 @@ <h1 class="title">{{ .Title }}</h1>
6162
{{ end }}
6263
版本: <a href="https://github.com/madawei2699/bmpi.dev/commit/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a>
6364
</div>
65+
{{ end }}
6466

6567
<div style="text-align: center;color: darkgray;">
6668
{{ if eq .Site.Language.Lang "zh-cn" }}

themes/hugo-coder/layouts/self/single.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ <h1 class="title">{{ .Title }}</h1>
4444
{{ $outContent := .Content | replaceRE $PATTERN_EMPTY_ALT $REPLACEMENT | replaceRE $PATTERN_ALT $REPLACEMENT | safeHTML }}
4545
{{ $outContent }}
4646

47+
{{ if .GitInfo }}
4748
<div style="color: #5c7080;font-size: small;font-style: italic;">
4849
更新时间:
4950
<!-- Calculate the age in days and months -->
@@ -61,6 +62,7 @@ <h1 class="title">{{ .Title }}</h1>
6162
{{ end }}
6263
版本: <a href="https://github.com/madawei2699/bmpi.dev/commit/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a>
6364
</div>
65+
{{ end }}
6466

6567
<div style="text-align: center;color: darkgray;">
6668
{{ if eq .Site.Language.Lang "zh-cn" }}

0 commit comments

Comments
 (0)