diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-01-13 10:40:35 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-01-13 10:40:35 -0500 |
| commit | b2440836ad13d489a3a0097df603e257adb079e4 (patch) | |
| tree | 49f6788424759d0814db83b5c7b58710bfbf934c | |
| parent | 7b31aa7a786d254d2a2a6e4afd93dbe426816874 (diff) | |
| download | samanthony.xyz-b2440836ad13d489a3a0097df603e257adb079e4.zip | |
add last modified date to footer
| -rw-r--r-- | hugo.toml | 9 | ||||
| -rw-r--r-- | layouts/_partials/copyright.html | 11 | ||||
| -rw-r--r-- | layouts/_partials/footer.html | 32 |
3 files changed, 30 insertions, 22 deletions
@@ -1,12 +1,15 @@ baseURL = 'https://www.samanthony.xyz/' languageCode = 'en-us' -title = "Sam Anthony" +title = 'Sam Anthony' theme = 'aoidh' +enableGitInfo = true [params] [params.author] - name = "Sam Anthony" - email = "sam@samanthony.xyz" + name = 'Sam Anthony' + email = 'sam@samanthony.xyz' + [params.repo] + url = 'https://git.samanthony.xyz/samanthony.xyz/' [menus] [[menus.main]] 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 @@ <hr> -<p> - {{- 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. -</p> +<p>{{ partial "copyright.html" . }}</p> <p> Powered by - <a href="https://gohugo.io/">Hugo</a> and + <a href="https://gohugo.io/">Hugo</a>, + <a href="https://www.openbsd.org/">OpenBSD</a>, and <a href="https://freedns.afraid.org/">Free DNS</a>. - <a href="https://git.samanthony.xyz/samanthony.xyz/">Source code →</a> +</p> +<p> + {{- $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" }}: + <a href="{{ $commitUrl }}">{{ .AbbreviatedHash }}</a>. + <a href="{{ $repoUrl }}">Source code →</a> + {{- end }} </p> |