# collections

> collections Liquid 对象：包含 Shoplazza 店铺的所有 collections，主题可遍历它构建列表，也可定位到某一个。

店铺中所有的 [collections](./collection)。

## 遍历 collections

您可以遍历 `collections` 来构建 collection 列表。

```liquid title="代码"
{% for collection in collections %}
  {{ collection.title | link_to: collection.url }}
{% endfor %}
```

```html title="输出"
<a href="/collections/all-collections">All Collections</a>
<a href="/collections/collection-2">Collection - 2</a>
<a href="/collections/new-boy">New Boy</a>
```

## 访问特定 collection

您可以使用 collections 通过其 id 访问某个 collection。

```liquid title="代码"
{% assign collection = collections[collection.id] %}

{% for product in collection.products %}
  {{ product.title | link_to: product.url }}
{% endfor %}
```

```html title="输出"
<a href="/products/ace-cashmere-beanie">Ace Cashmere Beanie</a>
<a href="/products/haldon-cashmere-crew">Haldon Cashmere Crew</a>
<a href="/products/lace-up-leather-manston-runner">Lace-up Leather Manston Runner</a>
```
