--- url: https://docs.youcan.shop/themes/templates/template-types/collection.md --- # collection The `collection` template renders a single collection and its products. ## Location The `collection` template is located in the `templates` directory of the theme. ```bash └── theme ├── layout ├── templates │ ... │ ├── collection.json │ ... ... ``` ## Content You should include the [category object](/themes/objects/category) in your collection template or a section inside of the template. ## Usage ### Paginate products The category object's `products` attribute is capped at X per page, so [paginate](/themes/tags/paginate#paginate) it to reach them all: ```liquid {% paginate collection.products by 24 cod, category_id: category.id %} {% for product in collection.products %} {% endfor %} {% endpaginate %} ``` ### Paginate sub-categories You can list sub categories of a category by iterating over the `subCategories` object which is an array of [category objects](/themes/objects/category) ```liquid {% for subCategory in subCategories %} {% endfor %} ```