templates/blog/blog.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Actualités & Blog - WA BENIN{% endblock %}
  3. {% block body %}
  4. <div class="page-header" style="height: 35vh; min-height: 250px; margin-bottom: 40px;">
  5. <div class="container fade-up">
  6. <h1 class="page-title">Actualités</h1>
  7. </div>
  8. </div>
  9. <section class="section-padding" style="padding-top: 0;">
  10. <div class="container">
  11. <div style="display: flex; gap: 40px; align-items: flex-start;">
  12. <!-- Main Content (Articles) -->
  13. <div style="flex: 2;">
  14. {% if featured_article %}
  15. <!-- Article à la une -->
  16. <div class="fade-up" style="background: #fff; border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow-soft); margin-bottom: 40px;">
  17. <div style="height: 400px; overflow: hidden;">
  18. <img src="{{ featured_article.image }}" alt="{{ featured_article.title }}" style="width: 100%; height: 100%; object-fit: cover; transition: var(--transition);">
  19. </div>
  20. <div style="padding: 30px;">
  21. <span style="background: var(--gold); color: #fff; padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; text-transform: uppercase;">À la une</span>
  22. <h2 style="margin: 15px 0; font-size: 2rem;">{{ featured_article.title }}</h2>
  23. <div style="color: #888; font-size: 0.9rem; margin-bottom: 20px; display: flex; gap: 15px;">
  24. <span><i class="far fa-calendar-alt"></i> {{ featured_article.createdAt|date('d M Y') }}</span>
  25. <span><i class="far fa-user"></i> Par {{ featured_article.author }}</span>
  26. </div>
  27. <p style="color: #555; margin-bottom: 20px; font-size: 1.1rem;">{{ featured_article.content|slice(0, 200) ~ '...' }}</p>
  28. <a href="{{ path('app_article_show', {id: featured_article.id}) }}" class="btn btn-outline">Lire la suite</a>
  29. </div>
  30. </div>
  31. {% endif %}
  32. <!-- Grille d'articles -->
  33. <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px;">
  34. {% for article in articles %}
  35. <!-- Article -->
  36. <div class="fade-up" style="background: #fff; border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow-soft);">
  37. <div style="height: 200px; overflow: hidden;">
  38. <img src="{{ article.image }}" alt="{{ article.title }}" style="width: 100%; height: 100%; object-fit: cover;">
  39. </div>
  40. <div style="padding: 20px;">
  41. <span style="color: var(--green); font-size: 0.8rem; font-weight: bold; text-transform: uppercase;">{{ article.category }}</span>
  42. <h3 style="margin: 10px 0; font-size: 1.3rem; line-height: 1.3;">{{ article.title }}</h3>
  43. <p style="color: #666; font-size: 0.95rem; margin-bottom: 15px;">{{ article.content|slice(0, 100) ~ '...' }}</p>
  44. <a href="{{ path('app_article_show', {id: article.id}) }}" style="color: var(--gold); font-weight: 600;">Lire l'article <i class="fas fa-arrow-right" style="font-size: 0.8rem; margin-left: 5px;"></i></a>
  45. </div>
  46. </div>
  47. {% else %}
  48. <p>Aucun article trouvé.</p>
  49. {% endfor %}
  50. </div>
  51. <!-- Pagination -->
  52. {% if total_pages > 1 %}
  53. <div style="margin-top: 40px; display: flex; justify-content: center; gap: 10px;">
  54. {% for i in 1..total_pages %}
  55. <a href="{{ path('app_blog', {page: i, category: current_category}) }}" style="width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; {% if current_page == i %}background: var(--gold); color: #fff; border: none;{% else %}background: #fff; border: 1px solid #ddd; color: var(--black-dark);{% endif %} border-radius: 8px; font-weight: bold;">
  56. {{ i }}
  57. </a>
  58. {% endfor %}
  59. </div>
  60. {% endif %}
  61. </div>
  62. <!-- Sidebar -->
  63. <div style="flex: 1; max-width: 350px;">
  64. <!-- Recherche -->
  65. <div style="background: #fff; padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow-soft); margin-bottom: 30px;">
  66. <h4 style="margin-bottom: 15px; font-size: 1.2rem;">Recherche</h4>
  67. <div style="position: relative;">
  68. <input type="text" placeholder="Mots-clés..." style="width: 100%; padding: 12px 15px; padding-right: 40px; border: 1px solid #ddd; border-radius: 8px; outline: none;">
  69. <i class="fas fa-search" style="position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #888;"></i>
  70. </div>
  71. </div>
  72. <!-- Catégories -->
  73. <div style="background: #fff; padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow-soft);">
  74. <h4 style="margin-bottom: 15px; font-size: 1.2rem;">Catégories</h4>
  75. <ul style="list-style: none; padding: 0; margin: 0;">
  76. <li style="padding: 10px 0; border-bottom: 1px solid #eee;">
  77. <a href="{{ path('app_blog') }}" style="color: {% if not current_category %}var(--gold){% else %}#555{% endif %}; display: flex; justify-content: space-between; font-weight: {% if not current_category %}bold{% else %}normal{% endif %};">
  78. Toutes les catégories
  79. </a>
  80. </li>
  81. {% for cat in categories %}
  82. <li style="padding: 10px 0; border-bottom: 1px solid #eee;">
  83. <a href="{{ path('app_blog', {category: cat}) }}" style="color: {% if current_category == cat %}var(--gold){% else %}#555{% endif %}; display: flex; justify-content: space-between; font-weight: {% if current_category == cat %}bold{% else %}normal{% endif %};">
  84. {{ cat }}
  85. </a>
  86. </li>
  87. {% endfor %}
  88. </ul>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </section>
  94. {% endblock %}