Home > Back-end >  Django breadcrumb html tag define list in include tag
Django breadcrumb html tag define list in include tag

Time:09-28

I want to for loop the names with bclist in breadcrumb.html

{% include 'breadcrumb.html' with bcTitle=category.name bcList=["test","tester"] %}

breadcrumb.html:

{% for i in bcList %}
    <li  aria-current="page">{{ i }}</li>
{% endfor %}

CodePudding user response:

As long as there are no spaces in the breadcrumb names:

{% with '1 2 3' as list %}
  {% for i in list.split %}
    {{ i }}<br>
  {% endfor %}
{% endwith %}
  • Related