Hi,
I have got a multilingual site and in the footer I want the same menu for both languages. It should be a social media list/menu with the same links in both languages.
Here is my hugo.toml:
baseURL = 'https://example.com/'
title = 'Example'
defaultContentLanguage = 'de'
defaultContentLanguageInSubdir = true
[languages]
[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch 🇩🇪'
contentDir = 'content/de'
weight = 1
[languages.de.menus]
[[languages.de.menus.main]]
name = 'Logos'
pageRef = '/logos'
weight = 10
[[languages.de.menus.main]]
name = 'Fotos'
pageRef = '/fotos'
weight = 20
[[languages.de.menus.main]]
name = 'Sketches'
pageRef = '/sketches'
weight = 30
[[languages.de.menus.main]]
name = 'Kontakt'
pageRef = '/kontakt'
weight = 40
[languages.en]
languageCode = 'en-US'
languageName = 'English 🇬🇧'
contentDir = 'content/en'
weight = 2
[languages.en.menus]
[[languages.en.menus.main]]
name = 'Logos'
pageRef = '/logos'
weight = 10
[[languages.en.menus.main]]
name = 'Photos'
pageRef = '/fotos'
weight = 20
[[languages.en.menus.main]]
name = 'Sketches'
pageRef = '/sketches'
weight = 30
[[languages.en.menus.main]]
name = 'Contact'
pageRef = '/kontakt'
weight = 40
[menus]
[[menus.footer]]
name = 'github'
url = 'https://github.com/test'
weight = 10
[[menus.footer]]
name = 'Stackoverflow'
url = 'https://stackoverflow.com/users/test'
weight = 20
[[menus.footer]]
name = 'youtube'
url = 'https://youtube.com'
weight = 30
[[menus.footer]]
name = 'FreeCodeCamp'
url = 'https://freecodecamp.org/test'
weight = 40
My footer:
<footer>
<div class="footer-logo">
<img alt="test Logo" src="/images/test-logos/test-Logo-footer.webp">
</div>
<div class="sitemap">
<h3 class="footer-headline">Sitemap</h3>
<ul>
{{ range site.Menus.main }}
<li class="footer-link">
<a href="{{ .URL }}">
{{ .Name }}
</a>
</li>
{{ end }}
</ul>
</div>
<div class="social-media">
<h3 class="footer-headline">Social Media</h3>
<ul>
{{ range .Site.Menus.footer }}
<li class="footer-link">
<a target="_blank" href="{{ .URL }}">
{{ .Name }}
</a>
</li>
{{ end }}
</ul>
</div>
<div class="copyright">
<p class="copyright-text">
Copyright {{ now.Year }}. Alle Rechte vorbehalten.
<span>
{{ $logicalPath := "/impressum" }}
{{ with site.GetPage $logicalPath }}
<a class="copy-imprint" href="{{ .RelPermalink }}">
{{ .Title }}
</a>
{{ else }}
{{ errorf "Unable to get page %s" $logicalPath }}
{{ end }}
</span>
</p>
</div>
</footer>
It was working, when I had it in both languages (the same menu in both), but I guess that there is a better way. Just one menu for both.