templates/blog/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body_id 'blog_index' %}
  3. {% block main %}
  4.     {% for post in paginator.results %}
  5.         <article class="post">
  6.             <h2>
  7.                 <a href="{{ path('blog_post', {slug: post.slug}) }}">
  8.                     {{ post.title }}
  9.                 </a>
  10.             </h2>
  11.             <p class="post-metadata">
  12.                 <span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|format_datetime('long', 'medium', '', 'UTC') }}</span>
  13.                 <span class="metadata"><i class="fa fa-user"></i> {{ post.author.fullName }}</span>
  14.             </p>
  15.             <p>{{ post.summary }}</p>
  16.             {{ include('blog/_post_tags.html.twig') }}
  17.         </article>
  18.     {% else %}
  19.         <div class="well">{{ 'post.no_posts_found'|trans }}</div>
  20.     {% endfor %}
  21.     {% if paginator.hasToPaginate %}
  22.         <div class="navigation text-center">
  23.             <ul class="pagination">
  24.                 {% if paginator.hasPreviousPage %}
  25.                     <li class="prev"><a href="{{ path('blog_index_paginated', {page: paginator.previousPage, tag: tagName}) }}" rel="previous"><i class="fa fw fa-long-arrow-left"></i> {{ 'paginator.previous'|trans }}</a></li>
  26.                 {% else %}
  27.                     <li class="prev disabled"><span><i class="fa fw fa-arrow-left"></i> {{ 'paginator.previous'|trans }}</span></li>
  28.                 {% endif %}
  29.                 {% for i in 1..paginator.lastPage %}
  30.                     {% if i == paginator.currentPage %}
  31.                         <li class="active"><span>{{ i }} <span class="sr-only">{{ 'paginator.current'|trans }}</span></span></li>
  32.                     {% else %}
  33.                         <li><a href="{{ path('blog_index_paginated', {page: i, tag: tagName}) }}">{{ i }}</a></li>
  34.                     {% endif %}
  35.                 {% endfor %}
  36.                 {% if paginator.hasNextPage %}
  37.                     <li class="next"><a href="{{ path('blog_index_paginated', {page: paginator.nextPage, tag: tagName}) }}" rel="next">{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></a></li>
  38.                 {% else %}
  39.                     <li class="next disabled"><span>{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></span></li>
  40.                 {% endif %}
  41.             </ul>
  42.         </div>
  43.     {% endif %}
  44. {% endblock %}
  45. {% block sidebar %}
  46.     {{ parent() }}
  47.     {{ show_source_code(_self) }}
  48.     {{ include('blog/_rss.html.twig') }}
  49. {% endblock %}