{% load i18n wagtailadmin_tags %}

{% if use_next_template %}
    {% include 'wagtailadmin/shared/breadcrumb-next.html' with trailing_breadcrumb_title=trailing_breadcrumb_title %}
{% else %}
    <nav aria-label="{% trans 'Breadcrumb' %}">
        <ul class="breadcrumb">
            {% for page in pages %}
                {% if page.is_root %}
                    {# Root section is shown as a 'site' icon in place of the title #}
                    {% trans "Root" as root %}
                    <li class="home breadcrumb-item"><a class="breadcrumb-link" href="{% url 'wagtailadmin_explore_root' %}">{% icon name="site" class_name="home_icon" title=root %}{% icon name="arrow-right" class_name="arrow_right_icon" %}</a></li>
                {% elif forloop.first %}
                    {# For limited-permission users whose breadcrumb starts further down from the root, the first item displays as a 'home' icon in place of the title #}
                    {% trans 'Home' as home %}
                    <li class="home breadcrumb-item"><a class="breadcrumb-link" href="{% url 'wagtailadmin_explore' page.id %}">{% icon name="site" class_name="home_icon" title=home %}{% icon name="arrow-right" class_name="arrow_right_icon"%}</a></li>
                {% elif forloop.last %}
                    <li class="breadcrumb-item">
                        <a class="breadcrumb-link" href="{% url 'wagtailadmin_explore' page.id %}"><span class="title">{{ page.get_admin_display_title }}</span></a>
                    </li>
                {% else %}
                    <li class="breadcrumb-item"><a class="breadcrumb-link" href="{% url 'wagtailadmin_explore' page.id %}"><span class="title">{{ page.get_admin_display_title }}</span>{% icon name="arrow-right" class_name="arrow_right_icon" %}</a></li>
                {% endif %}
            {% endfor %}
        </ul>
    </nav>
{% endif %}
