I’m displaying the categories of my blog in a menu. Now, I’d like to filter them.
I define a parameter in my config:
menuCategories = [ "Category 1", "Category 2" ]
And then use it as a filter in my layout:
{{ $whitelist := .Site.Params.menuCategories }}
{{ range .Site.Taxonomies.categories }}
{{ if (in .Page.Title $whitelist) }}
<li class="tag"><a title="{{ .Page.Title }}" href="{{ .Page.Permalink }}">{{ .Page.Title }}</a></li>
{{ end }}
{{ end }}
However, the if
statement never evaluates to true.
Is whitelist
not a list
here that I can use in
on?