{% for type, messages in message_list %}
    {% set class = include(directory ~ '/templates/misc/' ~ type ~ '.html.twig') %}
    <div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(class)|without('role', 'aria-label') }}>
        {% if type == 'error' %}
            <div role="alert">
        {% endif %}
        {% if status_headings[type] %}
            <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
        {% endif %}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        {% if messages|length > 1 %}
            <ul>
            {% for message in messages %}
                <li>{{ message }}</li>
            {% endfor %}
            </ul>
        {% else %}
            {{ messages|first }}
        {% endif %}
        {% if type == 'error' %}
            </div>
        {% endif %}
    </div>
{% endfor %}
