{# Breadcrumb trail — collapsed on narrow viewports, full on wide. Expects ``breadcrumbs``: list of dicts with ``label`` and optional ``url``. #} {% if breadcrumbs %} {# Full path — shown on wide viewports #} {% for crumb in breadcrumbs %} {% if not forloop.last %} {{ crumb.label }} / {% else %} {{ crumb.label }} {% endif %} {% endfor %} {# Collapsed path — shown on narrow viewports #} {% with last=breadcrumbs|last %} {% if breadcrumbs|length > 2 %} {{ breadcrumbs.0.label }} / / {{ last.label }} {% else %} {# Only 2 crumbs — no collapse needed, just duplicate the full view #} {% for crumb in breadcrumbs %} {% if not forloop.last %} {{ crumb.label }} / {% else %} {{ crumb.label }} {% endif %} {% endfor %} {% endif %} {% endwith %} {% endif %}