{% extends "base.html" %}

{% load static dsfr_tags wagtailcore_tags wagtailimages_tags i18n %}

{% block title %}
  <title>{{ title }} — {{ settings.sites_conformes_content_manager.CmsDsfrConfig.site_title }}</title>
{% endblock title %}

{% block description %}
  <meta name="description" content="{{ search_description }}" />
{% endblock description %}

{% block social_media %}
  <meta property="og:site_name"
        content="{{ settings.sites_conformes_content_manager.CmsDsfrConfig.site_title }}" />
  <meta property="og:title" content="{{ title }}" />
  <meta property="og:type" content="website" />
  <meta property="og:url" content="{{ request.build_absolute_uri }}" />
  <meta property="og:description" content="{{ search_description }}" />
  <meta property="og:locale" content="{{ LANGUAGE_CODE }}" />

  <meta name="twitter:title" content="{{ title }}" />
  <meta name="twitter:description" content="{{ search_description }}" />
{% endblock social_media %}

{% block content %}

  <div class="fr-container fr-mt-6w">
    {% dsfr_breadcrumb breadcrumb %}
    <h1>{{ title }}</h1>
    {% include "sites_conformes_content_manager/blocks/messages.html" %}
  </div>

  <div class="fr-container fr-mt-6w">
    <div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">
      {% for entry in object_list %}
        <div class="fr-col fr-col-md-6">
          <div class="fr-card fr-enlarge-link">
            <div class="fr-card__body">
              <div class="fr-card__content">
                <h2 class="fr-card__title">
                  <a href="{{ entry.url }}">{{ entry.title }}</a>
                </h2>
              </div>
            </div>
            {% if entry.header_image %}
              <div class="fr-card__header">
                <div class="fr-card__img">
                  <img class="fr-responsive-img"
                       src="{{ entry.header_image.file.url }}"
                       alt="">
                </div>
              </div>
            {% endif %}
          </div>
        </div>
      {% empty %}
        <p>Aucun article trouvé.</p>
      {% endfor %}
    </div>
  </div>

  {% if posts.paginator.num_pages > 1 %}
    <div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
  {% endif %}

{% endblock content %}
