theme: print out GitInfo in page footer if configured #786

This commit is contained in:
Sören Weber 2024-02-29 16:03:59 +01:00
parent 0d6fff1821
commit 02be3c3f26
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 32 additions and 4 deletions

View file

@ -18,6 +18,10 @@ This document shows you what's new in the latest release and flags it with one o
--- ---
## 5.25.0.beta (XXX) {#5250}
- {{% badge style="note" title=" " %}}Change{{% /badge %}} If you run Hugo with [GitInfo](https://gohugo.io/methods/page/gitinfo/) configured, the default page footer now prints out name, email address and date of the last commit. If you want to turn this off you either have to run Hugo without GitInfo (which is the default) or overwrite the `content-footer.html' partial.
## 5.24.0 (2024-02-28) {#5240} ## 5.24.0 (2024-02-28) {#5240}
- {{% badge color="fuchsia" icon="fab fa-hackerrank" title=" " %}}0.112.4{{% /badge %}} This release requires a newer Hugo version. - {{% badge color="fuchsia" icon="fab fa-hackerrank" title=" " %}}0.112.4{{% /badge %}} This release requires a newer Hugo version.

View file

@ -1,7 +1,31 @@
{{- $LastModifierDisplayName := "" }}
{{- $LastModifierEmail := "" }}
{{- $Date := "" }}
{{- with .GitInfo }}
{{- with .AuthorName }}
{{- $LastModifierDisplayName = . }}
{{- end }}
{{- with .AuthorEmail }}
{{- $LastModifierEmail = . }}
{{- end }}
{{- with .AuthorDate }}
{{- $Date = . | time.Format ":date_medium" }}
{{- end }}
{{- else }}
{{- with .Params.LastModifierDisplayName }} {{- with .Params.LastModifierDisplayName }}
<i class='fas fa-user'></i> {{ with $.Params.LastModifierEmail }}<a href="mailto:{{ . }}">{{ end }}{{ . }}{{ with $.Params.LastModifierEmail }}</a>{{ end }} {{- $LastModifierDisplayName = . }}
{{- with $.Date }} {{- end }}
<i class='fas fa-calendar'></i> {{ . | time.Format ":date_medium" }} {{- with .Params.LastModifierEmail }}
{{- $LastModifierEmail = . }}
{{- end }}
{{- with .Date }}
{{- $Date = . | time.Format ":date_medium" }}
{{- end }}
{{- end }}
{{- if $LastModifierDisplayName }}
<i class='fas fa-user'></i> {{ with $LastModifierEmail }}<a href="mailto:{{ . }}">{{ end }}{{ $LastModifierDisplayName }}{{ with $LastModifierEmail }}</a>{{ end }}
{{- with $Date }}
<i class='fas fa-calendar'></i> {{ . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- partial "term-list.html" (dict {{- partial "term-list.html" (dict