我想根据前缀过滤标签。假设我有这样的标签: filter-material-woolen,filter-material-woolen1,filter-febric-velvet,filter-febric-velvet1。所以我必须过滤标签,它的前缀是" filter -“,中间关键字如"material,febric”将作为标题,最后一个键将作为值。
<h1>material</h1>
<p>woolen1,woolen</p>
<h1>febric</h1>
<p>velvet,velvet1</p>发布于 2021-09-29 19:02:45
<ul>
{% for tag in collection.all_tags %}
{% if tag contains 'filter-' %}
<li>{{ tag | remove: 'filter-material-' | remove: 'filter-febric-' | link_to_tag: tag }}</li>
{% endif %}
{% endfor %}
</ul>https://stackoverflow.com/questions/69371012
复制相似问题