---
url: /
name: Home
description: The home page. Introduces the store and lists some products.
action: shop:products
template: default
published: true
---
<section class="home grid-container">
  <h1>{{ theme.storeTitle }}</h1>
  <section>
    <h2>Categories</h2>
    {{ partial('categories', {categories: categories}) }}
  </section>
  {% set featured_products = ('featured' | collection).products %}
  {% if featured_products | length %}
    <section class="callout">
      <h2>Featured</h2>
      {{ partial('product-list', {products: featured_products}) }}
    </section>
  {% else %}
    <section class="callout">
      <h2>Latest Products</h2>
      {{ partial('product-list',
        {products:
          products | extended_sort('created_at', true) | reverse | slice(0,6) })
      }}
    </section>
  {% endif %}
  <section>
    <h2>On Sale</h2>
    {% set sale_products = [] %}
    {% for product in products if product.onSale %}
      {% set sale_products = sale_products | merge([product])%}
    {% endfor %}
    {{ partial('product-list', {products: sale_products}) }}
  </section>
  <section>
    {{ content_block('about') }}
  </section>
  <section>
    {{ content_block('home-custom') }}
  </section>
</section>

---
url: /
name: Home
description: The home page. Introduces the store and lists some products.
action: shop:products
template: default
published: true
---
<section class="home grid-container">
  <h1>{{ theme.storeTitle }}</h1>
  <section>
    <h2>Categories</h2>
    {{ partial('categories', {categories: categories}) }}
  </section>
  {% set featured_products = ('featured' | collection).products %}
  {% if featured_products | length %}
    <section class="callout">
      <h2>Featured</h2>
      {{ partial('product-list', {products: featured_products}) }}
    </section>
  {% else %}
    <section class="callout">
      <h2>Latest Products</h2>
      {{ partial('product-list',
        {products:
          products | extended_sort('created_at', true) | reverse | slice(0,6) })
      }}
    </section>
  {% endif %}

  {% set sale_products = [] %}
  {% for product in products if product.onSale %}
    {% set sale_products = sale_products | merge([product])%}
  {% endfor %}
  <section class="callout primary">
    <h2>On Sale</h2>
    {% if sale_products | length %}
      {{ partial('product-list', {products: sale_products}) }}
    {% else %}
      There are no products on sale right now.
    {% endif %}
  </section>

  <section>
    {{ content_block('about') }}
  </section>

  <section>
    {{ content_block('home-custom') }}
  </section>

</section>

Make on sale callout and deal with empty case.
Make on sale callout and deal with empty case.
