From 674156343d0842f7aa23f01cd4238ca14f9454a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8hannes=20Lippmann?= Date: Wed, 28 Apr 2021 08:47:23 +0200 Subject: [PATCH] Allow to disable the footer with params.footer.enable = false Default is to have the footer enabled (to keep backwards compatibility). The diff looks much worse than it is, I just added a variable and an if clause, but then had to indent the rest of the file. Make footerEnabled an explicit variable. This should improve readability. Use default parameter for even more readability. --- layouts/partials/footer.html | 208 ++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 102 deletions(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 1503025..1f55f04 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,112 +1,116 @@ -{{ $author:= site.Data.author }} -{{ if (index site.Data site.Language.Lang).author }} - {{ $author = (index site.Data site.Language.Lang).author }} -{{ end }} +{{ $footerEnabled := site.Params.footer.enable | default true }} -{{ $sections:= site.Data.sections }} -{{ if (index site.Data site.Language.Lang).sections }} - {{ $sections = (index site.Data site.Language.Lang).sections }} -{{ end }} - -{{ $copyrightNotice := "© 2020 Copyright."}} -{{ if (index site.Data site.Language.Lang).site }} - {{ $siteConfig := (index site.Data site.Language.Lang).site }} - {{ if $siteConfig.copyright }} - {{ $copyrightNotice = $siteConfig.copyright }} +{{ if $footerEnabled }} + {{ $author:= site.Data.author }} + {{ if (index site.Data site.Language.Lang).author }} + {{ $author = (index site.Data site.Language.Lang).author }} {{ end }} -{{ end }} -{{/* footer logos */}} -{{ $themeLogo := "/images/theme-logo.png" }} -{{ $hugoLogo := "/images/hugo-logo.svg" }} + {{ $sections:= site.Data.sections }} + {{ if (index site.Data site.Language.Lang).sections }} + {{ $sections = (index site.Data site.Language.Lang).sections }} + {{ end }} -{{/* resize the logos. don't resize svg because it is not supported */}} -{{ $themeLogo:= resources.Get $themeLogo}} -{{ if and $themeLogo (ne $themeLogo.MediaType.SubType "svg") }} - {{ $themeLogo = $themeLogo.Resize "32x" }} -{{ end }} -{{ $themeLogo = $themeLogo.RelPermalink}} + {{ $copyrightNotice := "© 2020 Copyright."}} + {{ if (index site.Data site.Language.Lang).site }} + {{ $siteConfig := (index site.Data site.Language.Lang).site }} + {{ if $siteConfig.copyright }} + {{ $copyrightNotice = $siteConfig.copyright }} + {{ end }} + {{ end }} -{{ $hugoLogo:= resources.Get $hugoLogo}} -{{ if and $hugoLogo (ne $hugoLogo.MediaType.SubType "svg")}} - {{ $hugoLogo = $hugoLogo.Resize "32x" }} -{{ end }} -{{ $hugoLogo = $hugoLogo.RelPermalink}} + {{/* footer logos */}} + {{ $themeLogo := "/images/theme-logo.png" }} + {{ $hugoLogo := "/images/hugo-logo.svg" }} - +
+
+
+ +
{{ $copyrightNotice | markdownify }}
+ +
+
+ +{{end}}