{% extends 'partials/base.html.twig' %}

{% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}

{% block javascripts %}
    {% do assets.add('theme://js/singlepagenav.min.js') %}

    {{ parent() }}

{% endblock %}

{% block bottom %}
    {{ parent() }}

    <script>
    // singlePageNav initialization & configuration
    $('ul.navigation').singlePageNav({
        offset: $('#header').outerHeight(),
        filter: ':not(.external)',
        updateHash: true,
        currentClass: 'active'
    });
    </script>

{% endblock %}

{% block hero %}
    {% for module in page.collection() if module.template == 'modular/hero' %}
        <div id="{{ _self.pageLinkName(module.menu) }}"></div>
        {{ module.content }}
    {% endfor %}

{% endblock %}

{% block body %}
    {% for module in page.collection() if module.template != 'modular/hero' %}
        <div id="{{ _self.pageLinkName(module.menu) }}"></div>
        {{ module.content }}
    {% endfor %}

{% endblock %}
