Hi,
OK, I read about everything I could find about menus, IsMenuCurrent (and its “Has” companion) and multilingual sites but in vain : I can’t make it work for me.
So here are my personal instances of this apparently common problem
My menus are defined like this as per this topic :
[Languages]
[Languages.en]
weight = 1
languageName = "English"
title = "MyTitle"
[[Languages.en.menu.main]]
url = "/en/"
name = "Home"
identifier = "home"
weight = -1
[[Languages.en.menu.main]]
url = "/en/about_us/"
name = "About us"
identifier = "about"
weight = 1
Here is my menu template :
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main -}}
<li {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}class="active"{{ end }}>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{- end }}
</ul>
… needless to say : I don’t ever get any active link and this is the best I could get. I think I may have missed something in the front matter section of my pages but I can’t figure out what.
Any help appreciated.
thanks,
Pachacroute