跳到主要内容

collection

collection template 渲染专辑页面,列出专辑中的所有商品。

位置

collection template 位于 theme 的 templates 目录下:

└── theme
├── layout
├── templates
| ...
| ├── collection.liquid
| ...
...

内容

您应该在 template 的 section 中包含 collection 对象

collection 对象

您可以访问 Liquid collection 对象 来显示专辑的详细信息。

使用说明

使用 collection template 时,您应该熟悉以下内容:

筛选专辑

您可以使用店面筛选将专辑筛选为更小的商品子集。

分页显示商品

商品可以通过 collection 对象products 属性获取,您应该对专辑的商品进行分页处理,以确保所有商品都可以访问:

{% paginate collection.products by 20 %}
{% for product in collection.products %}
<!-- 商品信息 -->
{% endfor %}
{% endpaginate %}