list-collections.liquid
The list-collections.liquid
template is used to render a page where all of the collections in the shop are listed. This template can be accessed by going to /collections
of the shop.

Template Considerations
Re-ordering the collections
When you loop through the collections
array, the collections will be output in alphabetical order by default.
{% for collection in collections %}
<!-- Collection information here -->
{% endfor %}
There may be instances where you want to re-order the collections listed or pick and choose which collections to display. In such cases, you can load the collections from a menu instead: see Taking control of the collections listing page for more information.
Display a product image if a collection image does not exist
If a collection does not have a collection image, it is a good practice to show a product image instead. The example below is an if
statement that loads the featured image of the first product in the collection if the collection does not have its own collection image.
{% for collection in collections %}
{% if collection.image %}
<img src="{{ collection | img_url: '450x450' }}" alt="{{ collection.image.alt }}" />
{% else %}
<img src="{{ collection.products.first | img_url: '450x450' }}" alt="{{ collection.title | escape }}" />
{% endif %}
{% endfor %}