index.html.twig 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ parent() }} - Blog{% endblock %}
  3. {% block body %}
  4. {% if tag is defined %}
  5. <section>
  6. <h1>Etiquette : {{ tag }}</h1>
  7. </section>
  8. {% endif %}
  9. <div>
  10. <section id="section-articles">
  11. {% for article in articles %}
  12. <article class="article-preview">
  13. <header class="titre-article">
  14. <h1><a href="{{ path('app_view', {'slug': article.slug}) }}">{{ article.title}}</a></h1>
  15. <p class="article-by">{{ article.publicationDate | format_date('long') }} - {{ article.author }}</p>
  16. <p class="article-by">
  17. {% for tag in article.tags %}
  18. <a href="{{ path('app_search', {'tag': tag.name}) }}"><span class="tag">{{ tag }}</span></a>
  19. {% if not loop.last %} {% endif %}
  20. {% endfor %}
  21. </p>
  22. </header>
  23. <section class="contenu">
  24. {{ article.content | markdown }}
  25. </section>
  26. </article>
  27. <a href="{{ path('app_view', {'slug': article.slug}) }}">Voir l'article</a>
  28. {% if is_granted('edit', article) %}
  29. <a class="btn btn-blue" href="{{ path('app_article_edit', {'id': article.id}) }}">Modifier cet article</a>
  30. {% endif %}
  31. <hr>
  32. {% else %}
  33. <p class="remarque">Rien pour le moment</p>
  34. {% endfor %}
  35. </section>
  36. </div>
  37. {% endblock %}