Feat: improve the display of Git information in the post

This commit is contained in:
Cell
2025-04-24 18:06:59 +08:00
parent c21914dd49
commit a93f67762f
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.20-13604385" -}}
{{- .Scratch.Set "version" "v0.3.20-c21914dd" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+5 -2
View File
@@ -24,8 +24,11 @@
{{- dict "Date" . | T "single.updatedOnDate" -}} 
{{- if $gitRepo -}}
{{- with $.GitInfo -}}
{{/* TODO add Git .Body */}}
<a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
{{- $title := printf "%v&#10%v&#10Commit: %v [%v]&#10Author: %v<%v>&#10Date: %v" .Subject .Body .Hash .AbbreviatedHash .AuthorName .AuthorEmail (.AuthorDate | dateFormat "2006-01-02 15:04:05") -}}
{{- if ne .AuthorDate .CommitDate -}}
{{- $title = printf "%s&#10Commit Date: %v" $title (.CommitDate | dateFormat "2006-01-02 15:04:05") -}}
{{- end -}}
<a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="{{ $title | safeHTML }}">
{{- dict "Class" "fa-solid fa-hashtag fa-fw" | partial "plugin/icon.html" -}}
{{- .AbbreviatedHash -}}
</a>