Active menu and permalink eq url don't work

Hi, I’m trying to get active menu working but I can’t figure it out…

At first I tried this method:
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 }}
{{ 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 ?


Nvm, got it working with the first method just had to have the menu in content instead site config.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.