{% extends "layout.twig" %}

{% block title %}Mon Blog{% endblock %}

{% block content %}
{% for post in posts %}
<article class="post">
    <h2>{{ post.title }}</h2>

    <div class="post-meta">
        <small>Publié le {{ post.createdAt|date("d/m/Y à H:i") }}</small>
        {% if post.isRecent(7) %}
        <span class="badge badge-new">Nouveau</span>
        {% endif %}
    </div>

    <p>{{ post.getExcerpt(200) }}</p>

    <p>
        <a href="/article/{{ post.getSlug() }}">Lire la suite →</a>
    </p>
</article>
{% else %}
<p>Aucun article publié.</p>
{% endfor %}
{% endblock %}