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

{% set metatitle = maincontent.metatitle ? maincontent.metatitle : maincontent.menu %}
{% set metadescription = maincontent.metadescription? maincontent.metadescription: null %}
{% block metaOpengraph %}
    <meta property="og:url" content="{{ app.request.getSchemeAndHttpHost() ~ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}">
    <meta property="og:type" content="article">
    <meta property="og:locale" content="{{ app.request.locale }}">
    <meta property="og:image" content="{% if maincontent.picture != '' %}{{ app.request.getSchemeAndHttpHost() ~ asset(maincontent.getWebPath())|replace({' ':'%20'}) }}{% endif %}">
    <meta property="og:title" content="{{ maincontent.title }}">
    <meta property="og:description" content="{{ maincontent.article|striptags }}">
{% endblock %}

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

{% block body %}
    <div class="row">
        <article class="content simplePage col">
            {{ maincontent.article|replace_custom_keys|raw }}
        </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 %}