Hi, I’m trying to get active menu working but I can’t figure it out…
At first I tried this method: https://gohugo.io/templates/menu-templates/
No success with it… My hugo is v0.54.0/extended.
Then I tried my own method comparing url strings:
{{ $currentUrl := .Permalink }}
{{ range .Site.Menus.nav }}
{{ $url := .URL | absLangURL }}
<a href="{{ $url }}" {{ if eq $url $currentUrl }} class="active"{{ end }}>
{{ .Name }}
</a>
{{ end }}
It does not work either for some reason even tho the url strings are same as far as I can see with eye…
Can someone please tell me what I am doing wrong, why does it not work ?
Thanks