Note that were you menus config added through individual page’s Front Matter, you could access any Menu item’s page with .Page, and therefor perform more faithful and generic tests than with .Name.
Per example instead of testing the menu item’s .Name against the name of current page’s section, you could compare the sections.
{{ $active := or ($current.IsMenuCurrent "nav" .) ($current.HasMenuCurrent "nav" .) }}
{{ $active = or $active (eq .Page $current) }}
{{ $active = or $active (eq .Page.Section $current.Section)) }}
Unfortunately that doesn’t work as expected. This is a screenshot of the menu while on the “Blog” page (only the Blog menu item should be highlighted).
For debugging, I’ve printed the path.Dir for each menu item.
@ zwbetz: You are right. I had no Home nor any other root link in my menu, so it was working for me. I guess a check if the menu item belongs to Kindsection or page would also work. But that’s again adding extra lines. My example above made using .IsMenuCurrent, .HasMenuCurrent obsolete, so it was just a one liner. That’s why I suggested it, but as you pointed out, it is not working for every use case.
This looks correct. .URL | relLangURL and .RelPermalink are identical. Do they both change when you click on another link? (You posted a link to localhost.)