{% load i18n cms_tags extra_tags thumbnail %}
{% comment %}Obviously, the context template variable "category" is required and must be a Category page extension{% endcomment %}
{% with category_page=category.extended_object %}
<a class="category-glimpse category-glimpse--link" href="{{ category_page.get_absolute_url }}">
  <div class="category-glimpse__body">
    <div class="category-glimpse__logo">
      {% get_placeholder_plugins "logo" category_page as plugins or %}
        <div class="category-glimpse__logo__empty">{% trans "Logo" %}</div>
      {% endget_placeholder_plugins %}
      {% blockplugin plugins.0 %}
        <img src="{% thumbnail instance.picture 200x200 crop upscale subject_location=instance.picture.subject_location %}"
          srcset="
            {% thumbnail instance.picture 200x200 crop upscale subject_location=instance.picture.subject_location %} 200w,
            {% if instance.picture.width >= 400 %}{% thumbnail instance.picture 400x400 crop upscale subject_location=instance.picture.subject_location %} 400w,{% endif %}
            {% if instance.picture.width >= 600 %}{% thumbnail instance.picture 600x600 crop upscale subject_location=instance.picture.subject_location %} 600w{% endif %}
          "
          sizes="200px"
          alt=""
        />
      {% endblockplugin %}
    </div>
    <h{{ header_level|default:2 }} class="category-glimpse__title">
      {{ category_page.get_title }}
    </h{{ header_level|default:2 }}>
  </div>
</a>
{% endwith %}
