I’ve tried the samples on the docs, but my menu is not adding a class to the active menu element
What I have is:
The menu in config.toml
[menu]
[[menu.main]]
identifier = "posts"
name = "Home"
title = "blog section"
url = "/"
weight = 1
[[menu.main]]
identifier = "about"
name = "About"
title = "blog section"
url = "/about/"
weight = 2
[[menu.main]]
identifier = "contact"
name = "Contact"
title = "blog section"
url = "/contact/"
weight = 3
And then this in my header partial:
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<li class="{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}active{{ end }}">
<a href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
What am I doing wrong?