<!DOCTYPE html>
<html class="no-js">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />

    <title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
    {% if meta.description %}
        <meta name="description" content="{{ meta.description|striptags }}" />
    {% endif %}
    {% if meta.robots %}
        <meta name="robots" content="{{ meta.robots }}" />
    {% endif %}

    {% if current_page %}
        <link rel="canonical" href="{{ current_page.url }}" />
    {% endif %}

    <link rel="stylesheet" href="{{ theme_url }}/css/bootstrap.min.css" >
    <link rel="stylesheet" href="{{ theme_url }}/css/style.css" type="text/css" />
    <link rel="stylesheet" href="{{ theme_url }}/css/droidsans.css" type="text/css" />
    <link rel="stylesheet" href="{{ theme_url }}/css/fontello.css" type="text/css" />
    <link rel="shortcut icon" href="{{ theme_url }}/img/favicon.png">
    {% block head %}
    {% endblock %}
</head>
<body{% if config.theme_config.widescreen %} class="widescreen"{% endif %}>

    <header id="top" role="banner">
            <nav class="navbar navbar-expand-lg navbar-light bg-light justify-content-end sticky">
                <a id="logo" class="navbar-brand" href="{{ "index"|link }}">
                    <img style="height:100px;min-width:130px;" src="{{ pages["_meta"].meta.logo|url }}" alt="{{ site_title }}">
                    <span>{{ pages["_meta"].meta.tagline|markdown }}</span>
                </a>
                <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarsExample03" aria-controls="navbarsExample03" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                    
                <div class="collapse navbar-collapse flex-grow-0 ml-auto" id="navbarsExample03">
                        <ul class="navbar-nav mr-auto">
                            {% set tags = get_all_tags() %}
                            {% for page in pages if page.title %}
                                {% if parentPage and not (page.id starts with parentPage) %}
                                    {% set parentPage = null %}
                                    </ul>
                                    </li>
                                {% endif %}

                                {% set pageDepth = page.id|split('/')|length %}
                                {% if pageDepth == 1 %}
                                    <li class="{% if page.id == current_page.id %} active{% endif %} nav-link">
                                        <a href="{{ page.url }}">{{ page.title }}</a>
                                    </li>
                                {% elseif (pageDepth == 2) and (page.id ends with "/index") %}
                                    {% set parentPage = page.id|slice(0, -5) %}
                                    <li class="{% if page.id == current_page.id %} active{% endif %} dropdown show nav-link">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ page.title }}</a>
                                    <ul class="dropdown-menu">
                                    {% if page.title == 'Blog' %}
                                        <li class="nav-link"><a href="{{base_url}}/blog">Tous les articles</a></li>
                                        {% for tag in tags|sort %}
                                        <li class="nav-link"><a href="{{base_url}}/blog/?tag={{ tag }}">{{ tag }}</a></li>
                                        {% endfor %}
                                    {% endif %}
                                {% elseif (pageDepth == 2) and parentPage %}
                                    <li class="nav-link"><a href="{{ page.url }}">{{ page.title }}</a></li>
                                {% endif %}
                            {% endfor %}
                            </ul>
                            {% if parentPage %}
                                {% set parentPage = null %}
                                    </ul>
                                </li>
                            {% endif %}
                </div>
            </nav>
    </header>

    <div id="main" role="main">
        <section class="content wrap">
            {% block content %}
                {{ content }}
            {% endblock %}
        </section>
    </div>

    <footer id="bottom">
        <div class="container">
            <div class="row">
                <div class="col-md-5 col-sd-12">
                    {{ pages["_meta"].meta.bottomline|markdown }}
                </div>
                <div class="social col-md-7 col-sd-12">
                    <ul class="col-md-12 barre">
                    {% for social in pages["_meta"].meta.social %}
                    <li>
                    <a href="{{ social.url | url }}" title="{{ social.title }}" role="button">
                        <span class="icon-{{ social.icon }}" aria-hidden="true"></span>
                        <span >{{ social.title }}</span>
                    </a>
                    </li>
                    {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
    </footer>

    <script src="{{ theme_url }}/js/modernizr-3.3.1-custom.min.js" type="text/javascript"></script>
    <script src="{{ theme_url }}/js/utils.js" type="text/javascript"></script>
    <script src="{{ theme_url }}/js/pico.js" type="text/javascript"></script>
    <script src="{{ theme_url }}/js/jquery-3.3.1.slim.min.js" type="text/javascript"></script>
    <script src="{{ theme_url }}/js/bootstrap.min.js" type="text/javascript"></script>

</body>
</html>