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

{% block content %}
    <div class="blog-listing">
        <h1>{{ page.title }}</h1>
        <p>salut du template blog</p>   

        {% for child in page.collection() %}
            <article class="blog-item">
                <h2><a href="{{ child.url }}">{{ child.title }}</a></h2>
                {% if child.header.date %}
                    <span class="blog-date">{{ child.header.date|date("d M Y") }}</span>
                {% endif %}
                {% if child.header.author %}
                    <span class="blog-author">Par {{ child.header.author }}</span>
                {% endif %}
                <div class="blog-excerpt">
                    {{ child.summary|raw }}
                </div>
                <a href="{{ child.url }}" class="read-more">Lire la suite</a>
            </article>
        {% endfor %}
        {% for child in page.collection() %}
            <article class="blog-item">
                <h2><a href="{{ child.url }}">{{ child.title }}</a></h2>
                {% if child.header.date %}
                    <span class="blog-date">{{ child.header.date|date("d M Y") }}</span>
                {% endif %}
                {% if child.header.author %}
                    <span class="blog-author">Par {{ child.header.author }}</span>
                {% endif %}
                <div class="blog-excerpt">
                    {{ child.summary|raw }}
                </div>
                <a href="{{ child.url }}" class="read-more">Lire la suite</a>
            </article>
        {% endfor %}

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