templates/home/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ site_setting('site_name', 'ActuFake') }} - {{ site_setting('site_tagline', 'L\'actualité satirique en temps réel') }}{% endblock %}
  3. {% block body %}
  4. <div class="container-fluid px-0">
  5.     {% if featured_articles|length > 0 %}
  6.     {% set hero = featured_articles[0] %}
  7.     <section class="featured-article-hero">
  8.         {% if hero.featuredImage %}
  9.         {% set image_path = hero.featuredImage.path starts with '/' ? hero.featuredImage.path|slice(1) : hero.featuredImage.path %}
  10.         <img src="{{ base_path }}/{{ image_path }}" alt="{{ hero.featuredImage.alt }}">
  11.         {% else %}
  12.         <div style="width: 100%; height: 500px; background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);"></div>
  13.         {% endif %}
  14.         <div class="featured-overlay">
  15.             <div class="container">
  16.                 <span class="category-badge mb-2 d-inline-block">{{ hero.category.name }}</span>
  17.                 <h1>
  18.                     <a href="{{ path('article_show', {slug: hero.slug}) }}" class="text-white text-decoration-none">
  19.                         {{ hero.title }}
  20.                     </a>
  21.                 </h1>
  22.                 <p class="lead mb-3">{{ hero.excerpt|slice(0, 180) }}...</p>
  23.                 <div class="text-white-50">
  24.                     <i class="fas fa-user"></i> {{ hero.author ?? 'Rédaction' }}
  25.                     <span class="mx-2">|</span>
  26.                     <i class="fas fa-clock"></i> {{ hero.publishedAt|date('d M Y, H:i') }}
  27.                     <span class="mx-2">|</span>
  28.                     <i class="fas fa-eye"></i> {{ hero.viewCount }} vues
  29.                 </div>
  30.             </div>
  31.         </div>
  32.     </section>
  33.     {% endif %}
  34. </div>
  35. <div class="container my-5">
  36.     {% if featured_articles|length > 1 %}
  37.     <section class="mb-5">
  38.         <h2 class="section-title">À la une</h2>
  39.         <div class="row g-4">
  40.             {% for article in featured_articles|slice(1, 3) %}
  41.             <div class="col-md-4">
  42.                 <article class="card article-card h-100 border-0">
  43.                     {% if article.featuredImage %}
  44.                     {% set image_path = article.featuredImage.path starts with '/' ? article.featuredImage.path|slice(1) : article.featuredImage.path %}
  45.                     <img src="{{ base_path }}/{{ image_path }}" class="card-img-top" alt="{{ article.featuredImage.alt }}">
  46.                     {% else %}
  47.                     <div class="card-img-top bg-secondary d-flex align-items-center justify-content-center" style="height: 200px;">
  48.                         <i class="fas fa-newspaper fa-4x text-white opacity-25"></i>
  49.                     </div>
  50.                     {% endif %}
  51.                     <div class="card-body">
  52.                         <span class="category-badge mb-2">{{ article.category.name }}</span>
  53.                         <h5 class="card-title mt-2">
  54.                             <a href="{{ path('article_show', {slug: article.slug}) }}">
  55.                                 {{ article.title }}
  56.                             </a>
  57.                         </h5>
  58.                         <p class="card-text text-muted">{{ article.excerpt|slice(0, 120) }}...</p>
  59.                         <div class="d-flex justify-content-between align-items-center">
  60.                             <small class="text-muted">
  61.                                 <i class="fas fa-clock"></i> {{ article.publishedAt|date('d/m/Y') }}
  62.                             </small>
  63.                             <small class="text-muted">
  64.                                 <i class="fas fa-eye"></i> {{ article.viewCount }}
  65.                             </small>
  66.                         </div>
  67.                     </div>
  68.                 </article>
  69.             </div>
  70.             {% endfor %}
  71.         </div>
  72.     </section>
  73.     {% endif %}
  74.     <div class="row g-4">
  75.         <div class="col-lg-8">
  76.             <section class="latest-articles">
  77.                 <h2 class="section-title">Dernières actualités</h2>
  78.                 
  79.                 {% for article in latest_articles %}
  80.                 <article class="article-list-item">
  81.                     <div class="row g-3">
  82.                         <div class="col-md-4">
  83.                             {% if article.featuredImage %}
  84.                             <a href="{{ path('article_show', {slug: article.slug}) }}">
  85.                                 {% set image_path = article.featuredImage.path starts with '/' ? article.featuredImage.path|slice(1) : article.featuredImage.path %}
  86.                                 <img src="{{ base_path }}/{{ image_path }}" class="img-fluid" style="width: 100%; height: 180px; object-fit: cover;" alt="{{ article.featuredImage.alt }}">
  87.                             </a>
  88.                             {% else %}
  89.                             <div class="bg-secondary d-flex align-items-center justify-content-center" style="height: 180px;">
  90.                                 <i class="fas fa-image fa-3x text-white opacity-25"></i>
  91.                             </div>
  92.                             {% endif %}
  93.                         </div>
  94.                         <div class="col-md-8">
  95.                             <span class="category-badge mb-2">{{ article.category.name }}</span>
  96.                             <h3 class="mb-2" style="font-size: 1.5rem;">
  97.                                 <a href="{{ path('article_show', {slug: article.slug}) }}" class="text-decoration-none">
  98.                                     {{ article.title }}
  99.                                 </a>
  100.                             </h3>
  101.                             <p class="text-muted mb-2" style="line-height: 1.6;">{{ article.excerpt|slice(0, 200) }}...</p>
  102.                             <div class="d-flex justify-content-between align-items-center">
  103.                                 <small class="text-muted">
  104.                                     <strong>{{ article.author ?? 'Rédaction ActuFake' }}</strong>
  105.                                 </small>
  106.                                 <small class="text-muted">
  107.                                     {{ article.publishedAt|date('d M Y') }} • {{ article.viewCount }} vues
  108.                                 </small>
  109.                             </div>
  110.                         </div>
  111.                     </div>
  112.                 </article>
  113.                 {% else %}
  114.                 <div class="alert alert-info">
  115.                     <i class="fas fa-info-circle"></i> Aucun article publié pour le moment.
  116.                 </div>
  117.                 {% endfor %}
  118.             </section>
  119.         </div>
  120.         <div class="col-lg-4">
  121.             <aside>
  122.                 <div class="card mb-4 border-0 shadow-sm">
  123.                     <div class="card-header bg-danger text-white">
  124.                         <i class="fas fa-fire"></i> Tendances
  125.                     </div>
  126.                     <div class="list-group list-group-flush">
  127.                         {% for article in popular_articles %}
  128.                         <a href="{{ path('article_show', {slug: article.slug}) }}" class="list-group-item list-group-item-action border-0">
  129.                             <div class="d-flex align-items-start">
  130.                                 <span class="badge bg-danger me-2" style="font-size: 0.9rem; min-width: 25px;">{{ loop.index }}</span>
  131.                                 <div>
  132.                                     <h6 class="mb-1" style="font-weight: 700; line-height: 1.3;">{{ article.title }}</h6>
  133.                                     <small class="text-muted d-block mt-1">
  134.                                         <i class="fas fa-eye"></i> {{ article.viewCount }} vues
  135.                                     </small>
  136.                                 </div>
  137.                             </div>
  138.                         </a>
  139.                         {% endfor %}
  140.                     </div>
  141.                 </div>
  142.                 <div class="card mb-4 border-0 shadow-sm">
  143.                     <div class="card-header bg-dark text-white">
  144.                         <i class="fas fa-th-large"></i> Catégories
  145.                     </div>
  146.                     <div class="list-group list-group-flush">
  147.                         {% for category in categories %}
  148.                         <a href="{{ path('category_show', {slug: category.slug}) }}" class="list-group-item list-group-item-action border-0 d-flex justify-content-between align-items-center">
  149.                             <span style="font-weight: 600;">
  150.                                 {% if category.icon %}
  151.                                 <i class="fas {{ category.icon }} me-2"></i>
  152.                                 {% endif %}
  153.                                 {{ category.name }}
  154.                             </span>
  155.                             <span class="badge bg-dark rounded-pill">{{ category.articles|length }}</span>
  156.                         </a>
  157.                         {% endfor %}
  158.                     </div>
  159.                 </div>
  160.                 <div class="fake-disclaimer shadow-sm">
  161.                     <h6 style="font-weight: 700; color: #856404;">
  162.                         <i class="fas fa-exclamation-triangle"></i> Avertissement
  163.                     </h6>
  164.                     <p class="small mb-0" style="line-height: 1.6;">
  165.                         <strong>{{ site_setting('site_name', 'ActuFake') }} est un site satirique.</strong>
  166.                         Toutes les informations publiées sont fictives et à but humoristique uniquement.
  167.                         Ne les prenez pas au sérieux !
  168.                     </p>
  169.                 </div>
  170.             </aside>
  171.         </div>
  172.     </div>
  173. </div>
  174. {% endblock %}