如何获取液体文件中的唯一值

How to fetch unique value in liquid file

这是我的代码,我试图只从 items 变量中获取唯一值,但我得到了所有值,有人可以帮助解决这个问题吗

       {% capture items %}
          {% for tag in product.tags %}              
          {%if tag contains 'pair'%} 
          {% assign tag_split = tag  |  remove_first: 'pair::' | split: "::" %}
          {% assign color = tag_split[0]  %} 
             {{color}}
          {% endif %}
          {% endfor %}              
       {% endcapture %}

          {% assign my_array = items | split: ", " %}

          <p>{{ my_array | uniq }} </p>


         
         

此过滤器应该可以帮助您为每个值只保留一个元素: https://shopify.github.io/liquid/filters/uniq/