{% set html %}
    {% for segment in segments %}
        {% include '@nucleus/layout/' ~ segment.type ~ '.html.twig' with { 'segments': segment.children } %}
    {% endfor %}
{% endset %}

{% if segment.attributes.sticky or html|trim %}
    {% set id = segment.attributes.id|default('g-' ~ segment.id) %}
    {% set attr_extra = '' %}

    {% if segment.attributes.extra %}
        {% for attributes in segment.attributes.extra %}
            {% for key, value in attributes %}
                {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}
            {% endfor %}
        {% endfor %}
    {% endif %}

    <div id="{{ id }}"{{ attr_extra|raw }} class="{{ segment.attributes.class|default(id) }}">
        {{ html|raw }}
    </div>
{% endif %}
