From cea7d55af8fd8ebd0a765cbd450f7ac81d4e4113 Mon Sep 17 00:00:00 2001 From: zandi Date: Wed, 12 Jun 2024 17:07:22 -0400 Subject: [PATCH] Add multilingual check to optionally display language selection. Fixes #71 The `hugo.IsMultilingual` function (https://gohugo.io/functions/hugo/ismultilingual/) can be used to test if there is more than one configured language. If not, we just skip including the language selection partial layout. It can mistakenly appear for mono-lingual sites/content because it is always included, and the `lang.html` partial layout seems to iterate through the entire range of configured languages, even when it's only one language. Requires Hugo v0.124.0 or newer. --- layouts/partials/footer.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7ee64340..6c12f6d6 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,3 +1,5 @@ -{{- partial "lang.html" . -}} +{{ if hugo.IsMultilingual }} + {{- partial "lang.html" . -}} +{{ end }}