I am trying to loop over the articles in a blog to see if the article.tags contains any of the value in taggs where taggs is an array to be supplied by the user. I want to retrieve an array of related articles by tag.
When I run the code it returns no result. But when I created the article tags in lowercase, I got all the articles filtered as expected. Given that many of the users may not be creating tags in lowercase, I need a way to downcase the article.tags from the loop.
I tried {% capture atc %}{{ article.tags | downcase }}{% endcapture %} before the loop but it was not working.
You should also strip excess whitespace, end of lines, html and or handelize the tags to further normalize data being matches to potentially ambiguous user data.
Note there is no global tags object so taggs with double gg isnβt necessary unless your theme has already greedily taken that name for a variable.
Try to reserve using capture for outputs that will be repeated , such as snippets rendering , trying to do a kind of pseudo-interpolation, or long form text that would be obnxious to use with only an assign statement. https://shopify.dev/api/liquid/tags/variable-tags#capture