← back to Dw Theme Hamburger

snippets/collection-list-item.liquid

43 lines

{% assign link = link | default: nil %}
<article class="collections-list-item {% if use_masonry %}masonry-grid-item{% endif %}" {% if use_masonry %}data-masonry-item{% endif %}>

  {% if collection_list_item == 'linklist' %}
    {% assign link_handle = link.handle %}
    {% assign collection = collections[link_handle] %}
  {% endif %}

  <figure class="thumbnail">
    <a href="{{ collection.url }}">
      {% if collection.image %}
        {%
          render 'rimg',
          img: collection.image,
          size: '480x480',
          lazy: true
        %}
      {% elsif collection.products.first.featured_media.preview_image %}
        {%
          render 'rimg',
          img: collection.products.first.featured_media.preview_image,
          alt: collection.title,
          size: '480x480',
          lazy: true
        %}
      {% else %}
        {{ 'collection-1' | placeholder_svg_tag: 'placeholder-svg' }}
      {% endif %}
    </a>
  </figure>

  <h2 class="collection-title">
    <a href="{{ collection.url }}">{{ collection.title }}</a>
  </h2>

  {% if description and collection.description != blank %}
    <div class="collection-description rte">
      {{ collection.description | strip_html }}
    </div>
  {% endif %}

</article>