This code
{{- if isset .Site.Taxonomies "products" }}
{{- if not (eq (len .Site.Taxonomies.products) 0) }}
<ul class="list-unstyled">
{{- range $name, $items := .Site.Taxonomies.products }}
<li>
<a class="cat-item d-lg-flex justify-content-between text-dark"
href="{{ `products/` | relLangURL }}{{ $name | urlize | lower }}">{{ $name | title | humanize }}<span>{{len $items}}</span></a>
</li>
{{- end }}
</ul>
{{- end }}
{{- end }}
ranges products from the search index index.json file
{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "tags" .Params.tags "categories" .Params.categories "contents" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
I have following tags in watches.md product description file
# categories
categories : ["women"]
# products
products : ["watches"]
I am trying to put “where” condition into the range
{{- range where “categories” “women” $name, $items := .Site.Taxonomies.products }}
When I insert where into the range clause, I get the error message
undefined variable "$name"
What am I doing wrong? Guys, please help.
Thank you!