{% extends 'Front/layout.html.twig' %}

{% set metatitle = maincontent.metatitle ? maincontent.metatitle : maincontent.menu %}
{% set metadescription = maincontent.metadescription ? maincontent.metadescription : null %}

{% set bodyClass = maincontent.menu.class %}

{% block body %}
    <div class="row">
        <article class="content list col">
            <div class="content-text">
                {{ maincontent.article|replace_custom_keys|raw }}
            </div>

            <div class="row list-cards cards-content">
                {% for content in contents %}
                    <div class="col-md-6">
                        <article class="list-item card bg-theme">
                            <div class="item-header">
                                <div class="figure" {% if content.picture is not empty %}style="background-image: url({{ asset(content.getWebPath()|imagine_filter('500L'))|replace({' ' : '%20'}) }});"{% endif %}></div>
                            </div>
                            <div class="item-content">
                                <header>
                                    <h3>
                                        <a data-fancybox data-type="ajax" href="{{ path('modal_content', {content:content.id}) }}" rel="nofollow">{{ content.title }}</a>
                                    </h3>
                                </header>
        
                                {# <div class="item-desc">
                                    {{ content.article|striptags|truncate(300, false, ' ...')|raw }}
                                </div> #}
        
                                <footer class="item-more-actions">
                                    <p><a class="btn btn-xs btn-white" data-fancybox data-type="ajax" href="{{ path('modal_content', {content:content.id}) }}" rel="nofollow">{{ 'word.learn_more'|trans({}, 'word') }}</a></p>
                                </footer>
                            </div>
                        </article>
                    </div>
                {% endfor %}
            </div>
        </article>

        {% include "Front/_part/sidebar.html.twig" %}
    </div>
{% endblock %}

{% block before_body %} 
    {% set pageHeaderPicture = ( maincontent.picture ? asset(maincontent.getWebPath()) : null ) %}
    {% set pageHeaderTitle = maincontent.title %}
    {% set pageHeaderIntroduction = maincontent.introduction|replace_custom_keys|raw %}
    {% include "Front/_part/page-header.html.twig" %}
    {{ render(controller('AppBundle:Render:module', { position:'before_body' })) }}
{% endblock %}

{% block after_body %} 
    {{ render(controller('AppBundle:Render:module', { position:'after_body' })) }}
{% endblock %}