Why do theme developers put collection code in sections instead of templates?

In themes, the entry point for collection display is templates/collection.liquid (in the absence of a collection.json file).

In many themes that I have inspected, this file only contains this line:

{% section ‘collection-template’ %}

So the code responsible for displaying the collections lays in sections/collection-templace.liquid.

What are the advantages of not putting the code directly in templates/collection.liquid?

Hi @LC-official ,

With sections, you can help declare and add more flexible blocks, so that your layout can be set up in the most flexible way.

Refer https://shopify.dev/themes/architecture/sections

Hope it helps!