【发布时间】:2015-02-12 17:05:38
【问题描述】:
我正在尝试通过多个过滤器对一组产品进行排序。我想按标签(collection.products | sort: 'tags')和标题升序(collection.products | sort: 'title')对我的产品进行排序。我尝试了以下多种变体:
{% assign sortedProducts = collection.products | sort: 'title' | sort: 'tags' %}
{% assign sortedProducts = collection.products | sort: 'tags' | sort: 'title' %}
{% assign sortedProducts = collection.products | sort: 'title' %}
{% assign sortedProducts = sortedProducts | sort: 'tags' %}
{% assign sortedProducts = collection.products | sort: 'tags' %}
{% assign sortedProducts = sortedProducts | sort: 'title' %}
它们都不起作用。我看到的问题的答案涉及按标签过滤然后按字母顺序排序,但我希望在同一页面上按标签和标题排序。如果不可能,那么我会在排序前进一步研究按标签过滤。
谢谢!
【问题讨论】: