Files and Usage

1. Layouts

Layout files in Shopify Liquid provide a way to maintain consistent design elements across multiple pages. By creating a layout, you can define the common structure for all pages on your store.

<!DOCTYPE html>
<html>
<head>
  <title>{{ page.title }}</title>
</head>
<body>
  {{ content_for_layout }}
</body>
</html>

2. Templates

Templates are used to structure the content and layout of individual pages on your Shopify store. Each template corresponds to a specific page type, such as product pages, collection pages, or the homepage.

<!-- product.liquid -->
<h1>{{ product.title }}</h1>
<p>{{ product.description }}</p>

3. Includes

Includes are reusable snippets of code that can be used across multiple templates. They help in modularizing your Liquid code and promoting code reusability.

<!-- header.liquid -->
<header>
  <nav>
    <!-- Navigation links go here -->
  </nav>
</header>

4. Sections

Sections are content blocks that can be added and customized on different pages of your Shopify store. They allow merchants to modify the layout and content of pages without touching the theme code directly.

{% section 'slider' %}
{% section 'featured-products' %}