CSS Active Class on Content List


I am trying to set an active class on the <a> element below when the current page is loaded:

{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }} <ul class="global-nav"> {{ range $key, $value := $taxonomy }} <li> {{ $key }} </li> <ul> {{ range $value.Pages }} <li hugo-nav="{{ .RelPermalink}}"> <a class="active if current page" href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li> {{ end }} </ul> {{ end }} </ul> {{ end }}

Can someone please help me to achieve this?

Hi. Which version of Hugo are you using? What are you seeing in your output? What are you expecting to see?


Thanks for the reply.

I am using: v0.17
I am seeing (example: <a href="url here">page title here </a>
I am expecting to see (example: <a class="active" href="url here">page title here </a>

All I want to happen is a CSS class=active to appear on the <a> when the user is on that page.