Fix multiple active menu in taxonomy (#397)

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
Emruz Hossain 2021-08-16 23:24:56 +06:00 committed by GitHub
parent 7b92452e2b
commit 3c62edec20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,5 @@
{{ $context := .context }}
{{ $taxo := .taxo }}
{{ $title := .title }}
{{ $class:= "" }}
{{ if isset $context.Site.Taxonomies ( lower $taxo ) }}
{{ $taxonomy := index $context.Site.Taxonomies ( lower $taxo ) }}
@ -8,6 +7,8 @@
{{ 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 }}