{% extends 'partials/base.html.twig' %}

{% block content %}
<div class="post_bottom columns large-12">
  <div class="row">
    {% set top_name = page.header.top %}
    {% if top_name != "/actualites" %}
      <div class="columns small-12 recent-posts">
        <div  class=" row ">
          <div  class="columns large-12 thumb_news top">

              {% set top_page = page.find(top_name) %}
              {% set source = top_page.header.media_thumbnail %}

            {% if source != null%}
              {% set info = "url('"~top_page.url~"/"~source~"')" %}
            {% endif %}
            <a style="background: {{ info }} rgb(  233, 77, 26);" href="{{ top_page.url }}">
              <div class="row">
                <div class="columns large-8 align-self-bottom">
                  <mark>{{ top_page.title }}</mark>
                  <span class="tag" ><span>{{ top_page.header.taxonomy.tag|first }}</span></span>
                </div>
              </div>

            </a>

          </div>

        </div>
      </div>
    {% endif %}
    {% for post in page.collection %}
      {% set source = post.header.media_thumbnail %}
      {% if source != null %}
        {% set info = post.url~"/"~source %}
      {% else %}
        {% set info = null %}
      {% endif %}
      {% if top_page.title != post.title %}
      <div   class=" columns large-12 medium-12 medium-offset-0 small-8 small-offset-2 recent-posts">
        <div  class=" row ">
          <div  class="columns large-12 ">
            <a style="background: rgb(  233, 77, 26);" href="{{ post.url }}">
              <div class="row">
                <div class="columns small-4">
                  <img src="{{ info }}" alt="">
                </div>
                <div class="columns small-7 small-offset-0 align-self-middle">
                  <mark>{{ post.title }} - {{ post.header.publish_date|date("d/m/Y") }}</mark>
                  <span class="tag" ><span>{{ post.header.taxonomy.tag|first }}</span></span>
                  <br>
                  <p style="color:black;">
                    {{post.content|truncate(260, true)|raw|striptags  }}
                  </p>
                </div>
              </div>

            </a>
          </div>
        </div>
      </div>
      {% endif %}

    {% endfor %}
  </div>
  {% if config.plugins.pagination.enabled and page.collection.params.pagination %}
    {% include 'partials/pagination.html.twig' with {'base_url':page.url, 'pagination':collection.params.pagination} %}
  {% endif %}
</div>


{% endblock %}
