{% load i18n cms_tags extra_tags thumbnail %}
{% comment %}Obviously, the context template variable "person" is required and must be a Person page extension{% endcomment %}
{% with person_page=person.extended_object %}
<div class="person-glimpse">
  {% comment %}Use tabindex and aria-hidden on the image link as it is entirely redundant with the title link{% endcomment %}
  <a class="person-glimpse__media" href="{{ person_page.get_absolute_url }}" tabindex="-1" aria-hidden="true">
    {% get_placeholder_plugins "portrait" person_page as plugins or %}
      <p class="person-glimpse__media__empty">{% trans "Portrait" %}</p>
    {% 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 %}
  </a>
  <div class="person-glimpse__content">
    <div class="person-glimpse__content__wrapper">
      <a href="{{ person_page.get_absolute_url }}">
        <h{{ header_level|default:2 }} class="person-glimpse__content__wrapper__title">
          {{ person_page.get_title }}
        </h{{ header_level|default:2 }}>
      </a>
      <div class="person-glimpse__content__wrapper__categories">
        {% with form_factor="tag" %}
          {% show_placeholder "categories" person_page %}
        {% endwith %}
      </div>
      <div class="person-glimpse__content__wrapper__bio">
        {% show_placeholder "bio" person_page %}
      </div>
    </div>
  </div>
</div>
{% endwith %}
