collections_all

collections_all 模板渲染商品分类列表页面,该页面列出了商店的所有商品分类。该页面位于商店的 /collections-all URL。

image.png


位置

collections_all 模板位于主题的 templates 目录中:

└── theme
├── layout
├── templates
| ...
| ├── collections_all.json
| ...
...

内容

你可以在商品分类模板或模板内的某个 section 中包含以下内容:

collections 对象

你可以访问 Handlebars collections 对象来显示商店的商品分类。


用法

当使用 collections_all 模板时,你应该熟悉以下内容:

tip

如果你使用的是 JSON templates,那么任何 HTML 或 Handlebars 代码都需要包含在模板引用的 section 中。

展示商品分类列表

通常,在模板中展示所有商品分类,你可能会使用以下代码:

{{#for collections as |collection|}}
{{! collection info }}
{{/for}}

这篇文章对你有帮助吗?

Error loading component.

Error loading component.