From 02be3c3f268dc2e127b8e70498473c1c76bf8178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 29 Feb 2024 16:03:59 +0100 Subject: [PATCH] theme: print out GitInfo in page footer if configured #786 --- .../content/basics/migration/_index.en.md | 4 +++ layouts/partials/content-footer.html | 32 ++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index 78c45779b5..90761edebf 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -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} - {{% badge color="fuchsia" icon="fab fa-hackerrank" title=" " %}}0.112.4{{% /badge %}} This release requires a newer Hugo version. diff --git a/layouts/partials/content-footer.html b/layouts/partials/content-footer.html index 4e0bcdb3c8..6c6b356212 100644 --- a/layouts/partials/content-footer.html +++ b/layouts/partials/content-footer.html @@ -1,7 +1,31 @@ -{{- with .Params.LastModifierDisplayName }} - {{ with $.Params.LastModifierEmail }}{{ end }}{{ . }}{{ with $.Params.LastModifierEmail }}{{ end }} - {{- with $.Date }} - {{ . | time.Format ":date_medium" }} +{{- $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 }} + {{- $LastModifierDisplayName = . }} + {{- end }} + {{- with .Params.LastModifierEmail }} + {{- $LastModifierEmail = . }} + {{- end }} + {{- with .Date }} + {{- $Date = . | time.Format ":date_medium" }} + {{- end }} +{{- end }} +{{- if $LastModifierDisplayName }} + {{ with $LastModifierEmail }}{{ end }}{{ $LastModifierDisplayName }}{{ with $LastModifierEmail }}{{ end }} + {{- with $Date }} + {{ . }} {{- end }} {{- end }} {{- partial "term-list.html" (dict