updated nested menu template to correctly render product tags in v2

pull/1387/head
Scott Anderson 2020-08-31 11:39:51 -06:00
parent 2e6e1b6027
commit b86c16766e
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{{ $isV2 := cond (in .RelPermalink "/v2.") true false }}
{{ $page := .page }}
{{ $menu := .menu }}
{{ $isV2 := cond (in $page.RelPermalink "/v2.") true false }}
{{ define "productTag" }}
{{ if and (.Page.Params.products) (not .Page.Parent.Params.products) }}{{ range .Page.Params.products }}<span class="{{ . }}"></span>{{ end }}{{ end }}
@ -9,7 +9,7 @@
{{ range $menu }}
<li class="nav-category {{ if eq $page.RelPermalink .URL }}active{{end}}">
{{ if .HasChildren }}<a href="#" class="children-toggle {{ if or ($page.IsMenuCurrent .Menu .) ($page.HasMenuCurrent .Menu .) }}open{{end}}"></a>{{ end }}
<a href="{{ .URL }}">{{ .Name }} {{ if $isV2 }}{{ template "productTag" . }}{{ end }}</a>
<a href="{{ .URL }}">{{ .Name }} {{ $isV2 }}{{ if $isV2 }}{{ template "productTag" . }}{{ end }}</a>
{{ if .HasChildren }}
<ul class="children {{ if or ($page.IsMenuCurrent .Menu .) ($page.HasMenuCurrent .Menu .) }}open{{end}}">
{{ range .Children }}