From aea92352856b003ec957a5b26e623b2236c0af0e Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Mon, 16 Dec 2024 17:58:47 +0000 Subject: [PATCH 1/4] Add support for custom footer --- .../content/docs/advanced/customization.md | 21 +++++++++++++++++ layouts/partials/footer.html | 23 +++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/exampleSite/content/docs/advanced/customization.md b/exampleSite/content/docs/advanced/customization.md index 5c37b79..e37ee07 100644 --- a/exampleSite/content/docs/advanced/customization.md +++ b/exampleSite/content/docs/advanced/customization.md @@ -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. diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 61cbb11..7e79443 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -24,14 +24,23 @@
{{- end -}} {{- end -}} -
-
- {{- if (.Site.Params.footer.displayPoweredBy | default true) }}
{{ template "theme-credit" $poweredBy }}
{{ end }} - {{- if .Site.Params.footer.displayCopyright }}
{{ $copyright | markdownify }}
{{ end }} + + {{- if .Site.Params.footer.custom -}} +
+ {{ 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" ) }}
-
+ {{- else -}} +
+
+ {{- if (.Site.Params.footer.displayPoweredBy | default true) }}
{{ template "theme-credit" $poweredBy }}
{{ end }} + {{- if .Site.Params.footer.displayCopyright }}
{{ $copyright | markdownify }}
{{ end }} +
+
+ {{- end -}} {{- define "theme-credit" -}} From 756769d6d38e9b056a1f0705254eaa623a8bfbbb Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Tue, 17 Dec 2024 17:43:33 +0000 Subject: [PATCH 2/4] amend how the custom footer section is displayed --- exampleSite/content/docs/advanced/customization.md | 10 +++++----- layouts/partials/footer.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/exampleSite/content/docs/advanced/customization.md b/exampleSite/content/docs/advanced/customization.md index e37ee07..24b847d 100644 --- a/exampleSite/content/docs/advanced/customization.md +++ b/exampleSite/content/docs/advanced/customization.md @@ -62,18 +62,18 @@ 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 +## Custom Footer Section -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`: +You can add a custom section the footer between the language/theme buttons and the Copyright/Powered By section by creating a file `layouts/partials/custom/footer.html` in your site __and__ setting `customSection: 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 + customSection: true + # These settings are still respected displayCopyright: false displayPoweredBy: true - # This setting is respected by the custom footer + # This setting applies to the custom section with: "wide" ``` diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c6de318..1e391b4 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -25,22 +25,22 @@ {{- end -}} {{- end -}} - {{- if .Site.Params.footer.custom -}} + {{- if .Site.Params.footer.customSection -}}
{{ 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" ) }}
- {{- else -}} +
+ {{- end -}}
-
+
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}
{{ template "theme-credit" $poweredBy }}
{{ end }} - {{- if .Site.Params.footer.displayCopyright }}
{{ $copyright | markdownify }}
{{ end }} + {{- if .Site.Params.footer.displayCopyright }}
{{ $copyright | markdownify }}
{{ end }}
- {{- end -}} {{- define "theme-credit" -}} From 71b2b1176f105c83431d8c111e5f343a6f6f5ffb Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Tue, 17 Dec 2024 17:58:53 +0000 Subject: [PATCH 3/4] Add missing class --- exampleSite/hugo_stats.json | 1 + 1 file changed, 1 insertion(+) diff --git a/exampleSite/hugo_stats.json b/exampleSite/hugo_stats.json index 788b37d..6f3d4c0 100644 --- a/exampleSite/hugo_stats.json +++ b/exampleSite/hugo_stats.json @@ -327,6 +327,7 @@ "hx-gap-1", "hx-gap-2", "hx-gap-4", + "hx-gap-6", "hx-gap-x-1.5", "hx-gap-y-2", "hx-grid", From 797b485c9b20c929128f52f1ccbcb1dd818b5ed7 Mon Sep 17 00:00:00 2001 From: Attila Greguss Date: Tue, 17 Dec 2024 18:07:18 +0000 Subject: [PATCH 4/4] add missing class --- assets/css/compiled/main.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index f4c238d..f01f5c2 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -875,6 +875,9 @@ video { .hx-gap-4 { gap: 1rem; } +.hx-gap-6 { + gap: 1.5rem; +} .hx-gap-x-1\.5 { -moz-column-gap: 0.375rem; column-gap: 0.375rem;