Navbar: Best way to test what current page is

Maybe, this link would be helpful for you.

And I don’t get the point what’s the benefit hardcoded the menu.
The more general way is to make a menu.toml file in the config folder and use it something like this.

{{ range .Site.Menus.main }}
    <a href="{{ .URL | relURL }}">
        {{ safeHTML .Name }}
    </a>
{{ end }}

You can also active menu by compare the last URL element

{{ $lastUrlElement1 := index (last 1 (split (delimit (split .Permalink "/") "," "") ",")) 0 }}
 {{ $lastUrlElement2 := index (last 1 (split (delimit (split $currentURL "/") "," "") ",")) 0 }}
{{ if eq $lastUrlElement1 $lastUrlElement2 }}
  <div class="active"></div>
{{ end }}

You can set $currentURL outer scope of the range method