How do I set an "active" class for a top-level page in a menu?

I have a page whose URL is /about/ and a corresponding menu entry for it in my main nav. I would like to add an “active” class to it when I’m viewing the page.

I tried the following and it did not work:

{{ $currentNode := . }}
{{ range }}
<a href="{{ .URL }}" class="btn-header hidden-xs{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} active{{end}}">
  {{ .Name }}
{{ end }}

And in my config.toml:

    name = "About"
    identifier = "about"

What am I doing wrong?

Hi @joejanuszk - I don’t know if you solved your issue, but there’s a detailed discussion here:

Also be aware that there are a couple of tricks for defining menus - they can be defined at the site level in your main config file, and also in the frontmatter of an individual page. They get combined together when the site is built.