{% for text, url in breadcrumb %} {% if url %} {{ text|truncatechars:25 }} {% else %} {{ text|truncatechars:50 }} {% endif %} {% if not forloop.last %} {% endif %} {% endfor %}