From b2440836ad13d489a3a0097df603e257adb079e4 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Tue, 13 Jan 2026 10:40:35 -0500 Subject: add last modified date to footer --- layouts/_partials/copyright.html | 11 +++++++++++ layouts/_partials/footer.html | 32 +++++++++++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 layouts/_partials/copyright.html (limited to 'layouts/_partials') diff --git a/layouts/_partials/copyright.html b/layouts/_partials/copyright.html new file mode 100644 index 0000000..0fed830 --- /dev/null +++ b/layouts/_partials/copyright.html @@ -0,0 +1,11 @@ +{{- $oldest := (index .Site.RegularPages.ByDate 0).Date.Year }} +{{- $newest := (index .Site.Pages.ByLastmod.Reverse 0).Lastmod.Year }} +{{- if gt $newest $oldest }} + Copyright {{ $oldest }}–{{ $newest }} +{{- else }} + Copyright {{ $newest }} +{{- end }} +{{- with .Site.Params.author.name -}} + , {{ . }} +{{- end -}} +. diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html index d7aac7e..32249a9 100644 --- a/layouts/_partials/footer.html +++ b/layouts/_partials/footer.html @@ -1,24 +1,18 @@
-

- {{- with index (sort .Site.RegularPages "Date" "asc") 0 -}} - {{ $epoch := .Date }} - {{- with index (sort .Site.Pages "Lastmod" "desc") 0 -}} - {{ $lastMod := .Lastmod }} - {{- if gt $lastMod.Year $epoch.Year -}} - Copyright {{ $epoch.Year -}}–{{- $lastMod.Year -}} - {{- else -}} - Copyright {{ $epoch.Year -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- with .Site.Params.author.name -}} - , {{ . }} - {{- end -}} - . All rights reserved. -

+

{{ partial "copyright.html" . }}

Powered by - Hugo and + Hugo, + OpenBSD, and Free DNS. - Source code → +

+

+ {{- $repoUrl := .Site.Params.Repo.Url }} + {{- with .GitInfo }} + {{- $baseUrl := urls.JoinPath $repoUrl "/commit/" }} + {{- $commitUrl := printf "%s?id=%s" $baseUrl .Hash }} + Last modified {{ .CommitDate.Format "2006-01-02" }}: + {{ .AbbreviatedHash }}. + Source code → + {{- end }}

-- cgit v1.2.3