refactor(footer): Switch to custom footer template

This commit is contained in:
Nicolai Ort 2025-01-18 08:09:00 +01:00
parent 3e13e1a5f1
commit e03f3dd205
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
5 changed files with 53 additions and 8 deletions

View File

@ -101,7 +101,7 @@ params:
displayToggle: true displayToggle: true
footer: footer:
enable: true enable: true
displayCopyright: false displayCopyright: true
displayPoweredBy: false displayPoweredBy: false
width: normal width: normal
search: search:

1
i18n/de.yaml Normal file
View File

@ -0,0 +1 @@
copyright: 'Erstellt von <a href="https://odit.services/?ref=lfk-docs" target="_blank" rel="noreferrer" style="color:magenta !important; font-weight: bold;">ODIT.Services</a> mit ❤️, <a href="https://gohugo.io/" rel="noreferrer" target="_blank" style="color: rgb(63, 198, 250); font-weight: bold;">Hugo</a> und <a href="https://github.com/imfing/hextra" rel="noreferrer" target="_blank" style="color: rgb(51, 186, 145); font-weight: bold;">dem Hextra Theme</a><br>Entwickelt für den <a href="https://lauf-fuer-kaya.de" target="_blank" rel="noreferrer" style="color: #ebb951; font-weight: bold;">Lauf für Kaya! Spendenlauf</a> <br><a href="https://lauf-fuer-kaya.de/impressum" target="_blank" rel="noreferrer">Impressum</a> | <a href="https://lauf-fuer-kaya.de/datenschutz" target="_blank" rel="noreferrer">Datenschutz</a>'

View File

@ -3,4 +3,5 @@ admin: Administrators
selfservice: Selfservice selfservice: Selfservice
scanstation: Scaning Stations scanstation: Scaning Stations
beamershow: Beamer Show beamershow: Beamer Show
search: Search search: Search
copyright: 'Made by <a href="https://odit.services/?ref=lfk-docs" target="_blank" rel="noreferrer" style="color:magenta !important; font-weight: bold;">ODIT.Services</a> with ❤️, <a href="https://gohugo.io/" rel="noreferrer" target="_blank" style="color: rgb(63, 198, 250); font-weight: bold;">Hugo</a> and <a href="https://github.com/imfing/hextra" rel="noreferrer" target="_blank" style="color: rgb(51, 186, 145); font-weight: bold;">the Hextra theme</a><br>Developed for the <a href="https://lauf-fuer-kaya.de" target="_blank" rel="noreferrer" style="color: #ebb951; font-weight: bold;">Lauf für Kaya! charity run</a> <br><a href="https://lauf-fuer-kaya.de/impressum" target="_blank" rel="noreferrer">Imprint</a> | <a href="https://lauf-fuer-kaya.de/datenschutz" target="_blank" rel="noreferrer">Privacy</a>'

View File

@ -1,6 +0,0 @@
<p style="text-align: center !important;">
Made by <a href="https://odit.services/?ref=lfk-docs" target="_blank" rel="noreferrer" style="color:magenta !important; font-weight: bold;">ODIT.Services</a> with ❤️
and <a href="https://gohugo.io/" rel="noreferrer" target="_blank" style="color: rgb(63, 198, 250); font-weight: bold;">Hugo</a> -
Developed for the <a href="https://lauf-fuer-kaya.de" target="_blank" rel="noreferrer" style="color: #ebb951; font-weight: bold;">Lauf für Kaya! charity run</a> <br>
<a href="https://lauf-fuer-kaya.de/impressum" target="_blank" rel="noreferrer">Imprint</a> | <a href="https://lauf-fuer-kaya.de/datenschutz" target="_blank" rel="noreferrer">Privacy</a>
</p>

View File

@ -0,0 +1,49 @@
{{- $enableFooterSwitches := .Scratch.Get "enableFooterSwitches" | default false -}}
{{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}}
{{- $footerSwitchesVisible := and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}}
{{- $copyrightSectionVisible := or (.Site.Params.footer.displayPoweredBy | default true) .Site.Params.footer.displayCopyright -}}
{{- $copyright := (T "copyright") | default "© 2024 Hextra." -}}
{{- $poweredBy := (T "poweredBy") | default "Powered by Hextra" -}}
{{- $footerWidth := "hx-max-w-screen-xl" -}}
{{- with .Site.Params.footer.width -}}
{{ if eq . "wide" -}}
{{ $footerWidth = "hx-max-w-[90rem]" -}}
{{ else if eq . "full" -}}
{{ $footerWidth = "max-w-full" -}}
{{ end -}}
{{- end -}}
<footer class="hextra-footer hx-bg-gray-100 hx-pb-[env(safe-area-inset-bottom)] dark:hx-bg-neutral-900 print:hx-bg-transparent">
{{- if $footerSwitchesVisible -}}
<div class="hx-mx-auto hx-flex hx-gap-2 hx-py-2 hx-px-4 {{ $footerWidth }}">
{{- partial "language-switch.html" (dict "context" .) -}}
{{- with $displayThemeToggle }}{{ partial "theme-toggle.html" }}{{ end -}}
</div>
{{- if or hugo.IsMultilingual $displayThemeToggle -}}
<hr class="dark:hx-border-neutral-800" />
{{- end -}}
{{- end -}}
{{- if $copyrightSectionVisible -}}
<div
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-1 hx-pl-[max(env(safe-area-inset-left),1.5rem)] hx-pr-[max(env(safe-area-inset-right),1.5rem)] hx-text-gray-600 dark:hx-text-gray-400 md:hx-justify-start"
>
<div class="hx-flex hx-w-full hx-flex-col sm:hx-items-start">
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-1 hx-text-xs">{{ $copyright | markdownify }}</div>{{- end -}}
</div>
</div>
{{- end -}}
</footer>
{{- define "theme-credit" -}}
<a class="hx-flex hx-text-sm hx-items-center hx-gap-1 hx-text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
<span>
{{- . | markdownify -}}
{{- if strings.Contains . "Hextra" -}}
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="hx-inline-block ltr:hx-ml-1 rtl:hx-mr-1 hx-align-[-2.5px]"`) -}}
{{- end -}}
</span>
</a>
{{- end -}}