templates/category/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ category.name }} - ActuFake{% endblock %}
  3. {% block body %}
  4. <div class="container my-5">
  5.     <div class="category-header mb-5 text-center">
  6.         {% if category.icon %}
  7.         <i class="fas {{ category.icon }} fa-3x mb-3" style="color: {{ category.color ?? '#000' }};"></i>
  8.         {% endif %}
  9.         <h1 class="display-4 mb-3">{{ category.name }}</h1>
  10.         {% if category.description %}
  11.         <p class="lead text-muted">{{ category.description }}</p>
  12.         {% endif %}
  13.     </div>
  14.     <div class="row">
  15.         {% for article in articles %}
  16.         <div class="col-md-4 mb-4">
  17.             <div class="card article-card h-100">
  18.                 {% if article.featuredImage %}
  19.                 {% set image_path = article.featuredImage.path starts with '/' ? article.featuredImage.path|slice(1) : article.featuredImage.path %}
  20.                 <img src="{{ base_path }}/{{ image_path }}" class="card-img-top" alt="{{ article.title }}">
  21.                 {% else %}
  22.                 <div class="card-img-top bg-secondary text-white d-flex align-items-center justify-content-center" style="height: 200px;">
  23.                     <i class="fas fa-newspaper fa-3x opacity-25"></i>
  24.                 </div>
  25.                 {% endif %}
  26.                 <div class="card-body">
  27.                     <h5 class="card-title">
  28.                         <a href="{{ path('article_show', {slug: article.slug}) }}" class="text-decoration-none text-dark">
  29.                             {{ article.title }}
  30.                         </a>
  31.                     </h5>
  32.                     <p class="card-text">{{ article.excerpt|slice(0, 120) }}...</p>
  33.                     <p class="card-text">
  34.                         <small class="text-muted">
  35.                             <i class="fas fa-calendar"></i> {{ article.publishedAt|date('d/m/Y') }}
  36.                             <i class="fas fa-eye ms-2"></i> {{ article.viewCount }}
  37.                         </small>
  38.                     </p>
  39.                 </div>
  40.             </div>
  41.         </div>
  42.         {% else %}
  43.         <div class="col-12">
  44.             <p class="text-center text-muted">Aucun article dans cette catégorie.</p>
  45.         </div>
  46.         {% endfor %}
  47.     </div>
  48.     {% if articles.pageCount > 1 %}
  49.     <div class="navigation mt-4">
  50.         {{ knp_pagination_render(articles) }}
  51.     </div>
  52.     {% endif %}
  53. </div>
  54. {% endblock %}