hugo-toha/layouts/partials/navigators/taxonomies.html
Emruz Hossain 3c62edec20
Fix multiple active menu in taxonomy (#397)
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
2021-08-16 17:24:56 +00:00

16 lines
633 B
HTML

{{ $context := .context }}
{{ $taxo := .taxo }}
{{ $class:= "" }}
{{ if isset $context.Site.Taxonomies ( lower $taxo ) }}
{{ $taxonomy := index $context.Site.Taxonomies ( lower $taxo ) }}
{{ if (gt (len $taxonomy) 0)}}
{{ range $taxonomy }}
{{if eq $context.Title .Page.Title}}
{{ $class = "active" }}
{{else}}
{{$class = ""}}
{{end}}
<li><a class="taxonomy-term {{ $class }}" href="{{ .Page.Permalink }}" data-taxonomy-term="{{ urlize .Page.Title }}"><span class="taxonomy-label">{{ .Page.Title }}</span></a></li>
{{ end }}
{{ end }}
{{ end }}