So, I’m running into an issue that could be classified as having a “typo” in a tag…
I basically have a section.html
template, and I want to show any articles that have the same tags
as that particular foo/_index.md
section page.
In the section.html
template, I have:
{{ $articles := ((where $section.Pages ".Params.tags" "intersect" .Params.tags).ByParam "author.last_name").ByWeight }}
<ul>
{{ range $articles }}
<li>{{ .Title }}</li>
{{ end }}
</ul>
And, here’s the foo/_index.md
section page front matter:
---
title: "Foo Section"
tags: ["oot", "leadership"]
...
---
Now, if I have articles with tags: ["oot"]
or tags: ["leadership"]
, they will indeed show up in the template.
However, if the author accidentally tags an article with tags: ["OOT"]
or tags: ["LeaderShip"]
instead, they will not show up.
An obvious solution would be to just force all the tags in the comparison to lowercase; however, the below gives an error, and I’m not sure how to structure the where
statement to do that?
{{ $articles := ((where $section.Pages (".Params.tags" | lower) "intersect" (.Params.tags | lower )) }}