{% if data.size > 0 %}
  {% assign media = data | normalizeMedia %}
  <div class="media-grid {% if shape == 'square' %}square{% else %}vertical{% endif %}">
    {% for item in media limit: count %}
      {% assign alt = item.alt | strip | escape %}
      {% assign hasMeta = item.type != 'book' and item.type != 'movie' %}
      <a href="{{ item.url | stripUtm }}" title="{{ alt }}">
        <div class="item-wrapper{% if hasMeta %} shadow{% endif %}">
          {% if hasMeta %}
            <div class="meta-text">
              {% if item.title %}
                <div class="header">{{ item.title }}</div>
              {% endif %}
              {% if item.subtext %}
                <div class="subheader">
                  {{ item.subtext }}
                </div>
              {% endif %}
            </div>
          {% endif %}
          {%- capture loadingStrategy -%}
            {%- if loading -%}{{ loading }}{%- else -%}lazy{%- endif -%}
          {%- endcapture -%}
          {% image item.image, alt, '', loadingStrategy %}
        </div>
      </a>
    {% endfor %}
  </div>
{% endif %}