Compare commits

...

3 Commits

Author SHA1 Message Date
Attila Greguss
db1706c0ed
Merge 0c2c148f5e47724761c910541a4b606d06f71410 into bc778ee243e2a4a22ee5413adffde5baf79c079d 2024-12-17 10:21:33 +00:00
Attila Greguss
0c2c148f5e Merge branch 'main' into custom-footer 2024-12-17 10:21:27 +00:00
Attila Greguss
aea9235285 Add support for custom footer 2024-12-16 17:58:47 +00:00
2 changed files with 37 additions and 7 deletions

View File

@ -62,6 +62,27 @@ You may add custom scripts to the end of the head for every page by adding the f
layouts/partials/custom/head-end.html
```
## Custom Footer
You can replace the footer completely - excluding the language and theme buttons - by creating a file `layouts/partials/custom/footer.html` in your site __and__ setting `custom: true` in the `footer` section of your `hugo.yaml`:
```yaml {filename="hugo.yaml"}
footer:
enable: true
custom: true
# These settings are ignored by the custom footer
displayCopyright: false
displayPoweredBy: true
# This setting is respected by the custom footer
with: "wide"
```
Variables available in the footer are:
- `{{ .footerButtonColor }}` - The color/background color of a footer button
_Note: The custom footer inherits the default footer background color and text color._
## Custom Layouts
The layouts of the theme can be overridden by creating a file with the same name in the `layouts` directory of your site.

View File

@ -24,14 +24,23 @@
<hr class="dark:hx-border-neutral-800" />
{{- end -}}
{{- end -}}
<div
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-12 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 hx-items-center sm:hx-items-start">
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx-font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{ end }}
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>{{ end }}
{{- if .Site.Params.footer.custom -}}
<div
class="{{ $footerWidth }} hx-pl-[max(env(safe-area-inset-left),0rem)] hx-pr-[max(env(safe-area-inset-right),0rem)] hx-text-gray-600 dark:hx-text-gray-400"
>
{{ partial "custom/footer.html" (dict "context" . "footerButtonColor" "hx-rounded-md hx-transition-colors hover:hx-bg-gray-100 hover:hx-text-gray-900 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50" ) }}
</div>
</div>
{{- else -}}
<div
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-12 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 hx-items-center sm:hx-items-start">
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx-font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{ end }}
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>{{ end }}
</div>
</div>
{{- end -}}
</footer>
{{- define "theme-credit" -}}