taxonomies - add active class
This commit is contained in:
parent
f420e5763c
commit
47906d8f84
1 changed files with 5 additions and 1 deletions
|
@ -1,11 +1,15 @@
|
|||
{{ $context := .context }}
|
||||
{{ $taxo := .taxo }}
|
||||
{{ $title := .title }}
|
||||
{{ $class:= "" }}
|
||||
{{ if isset $context.Site.Taxonomies ( lower $taxo ) }}
|
||||
{{ $taxonomy := index $context.Site.Taxonomies ( lower $taxo ) }}
|
||||
{{ if (gt (len $taxonomy) 0)}}
|
||||
{{ range $taxonomy }}
|
||||
<li><a class="taxonomy-term" href="{{ .Page.Permalink }}" data-taxonomy-term="{{ urlize .Page.Title }}"><span class="taxonomy-label">{{ .Page.Title }}</span></a></li>
|
||||
{{if eq $context.Title .Page.Title}}
|
||||
{{ $class = "active" }}
|
||||
{{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 }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue