templates/foundation/front/shared/post_list.html.twig line 1

  1. {% if posts is defined and posts is not empty %}
    {% for elt in posts %}
        <article class="article {% if loop.index > 6 %}hidden{% endif %} m_item-news  m_item-post ">
            <div class="m_item-news-container m_position-relative">
                <div class="m_item-news-thumb m_item-post-thumb">
                    <img alt="" title=""
                         src="{{ elt.thumbnail is defined and elt.thumbnail.filename is defined
                         ? path('proxy_avatar', {'path': elt.thumbnail.filename})
                         : asset('images/defaults/media.png') }}"/>
                </div>
                <div class="m_item-news-content m_item-post-content">
                    {% set localeCode = elt.i18ns[0].locale|split('_')|first %}
                    {% set i18n = (app.request.locale == localeCode and elt.i18ns[0] is defined) ? elt.i18ns[0] : (elt.i18ns[1] is defined ? elt.i18ns[1] : null) %}
                    {% if i18n %}
    
                        {# Affichage de la date de publication #}
                        {% if elt.publishedDate is defined %}
                            <time datetime="{{ elt.publishedDate|date('Y-m-d') }}" class="m_post-date">
                                {{ elt.publishedDate|format_date(locale= app.request.locale, pattern='d MMMM y') }}
    
                            </time>
                        {% endif %}
                        {% if elt.category is defined and elt.category.i18ns is defined %}
                            {% set categoryI18n =(app.request.locale == localeCode and  elt.category.i18ns[0] is defined) ?  elt.category.i18ns[0] : ( elt.category.i18ns[1] is defined ?  elt.category.i18ns[1] : null) %}
                            {% if categoryI18n is defined %}
                                <div class="m_badge-category">
                                    {{ categoryI18n.name }}
                                </div>
                            {% endif %}
                        {% endif %}
                        <h3>{{ i18n.name|u.truncate(90, '...') }}</h3>
                        <div class="m_item-news-excerpt m_item-post-excerpt">
                            <p>{{ i18n.description|u.truncate(120, '...')|raw }}</p>
                        </div>
                    {% endif %}
                        <a href="{{ path('app_posts_detail',{'id':elt.id,'slug':i18n.slug}) }}"
                           class="m_underline-link-blue"
                           title={{ 'see.more'|trans }}>{{ 'see.more'|trans }}</a>
                </div>
                    <a href="{{ path('app_posts_detail',{'id':elt.id,'slug':i18n.slug}) }}" class="m_link-overlay"
                       title={{ 'see.more'|trans }}></a>
            </div>
        </article>
    {% endfor %}
    {% endif %}