{% load i18n %}
{% translate "you are here:" as you_are_here %}
{% if self.get_ancestors|length > 1 %}
  <nav role="navigation"
       class="fr-breadcrumb"
       aria-label="{{ you_are_here }}">
    <button class="fr-breadcrumb__button"
            aria-expanded="false"
            aria-controls="page-breadcrumb">{% translate "See breadcrumb" %}</button>
    <div class="fr-collapse" id="page-breadcrumb">
      <ol class="fr-breadcrumb__list">
        {% for p in self.get_ancestors %}
          {% if p.is_site_root %}
            <li>
              <a class="fr-breadcrumb__link" href="{{ p.url }}">{% translate "Home page" %}</a>
            </li>
          {% elif p.is_root == False %}
            <li>
              <a class="fr-breadcrumb__link" href="{{ p.url }}">{{ p.title|truncatewords:4 }}</a>
            </li>
          {% endif %}
        {% endfor %}
        {% if extra_breadcrumbs %}
          {% for link in extra_breadcrumbs.links %}
            <li>
              <a class="fr-breadcrumb__link" href="{{ link.url }}">{{ link.title|truncatewords:4 }}</a>
            </li>
          {% endfor %}
          <li>
            <a class="fr-breadcrumb__link" aria-current="page">{{ extra_breadcrumbs.current|truncatewords:6 }}</a>
          </li>
        {% else %}
          <li>
            <a class="fr-breadcrumb__link" aria-current="page">{{ self.title|truncatewords:6 }}</a>
          </li>
        {% endif %}
      </ol>
    </div>
  </nav>
{% endif %}
