breadcrumb.swig 872 B

123456789101112131415161718192021222324252627
  1. {%- set paths = page.path.split('/') %}
  2. {%- set count = paths.length %}
  3. {%- if count > 2 %}
  4. {%- set current = 0 %}
  5. {%- set link = '' %}
  6. <ul class="breadcrumb">
  7. {%- for path in paths %}
  8. {%- set current = current + 1 %}
  9. {%- if path != 'index.html' %}
  10. {%- if current == count - 1 and paths[count - 1] == 'index.html' %}
  11. <li>{{ path | upper }}</li>
  12. {% else %}
  13. {%- if link == '' %}
  14. {%- set link = '/' + path %}
  15. {% else %}
  16. {%- set link = link + '/' + path %}
  17. {%- endif %}
  18. {%- if path.includes('.html') %}
  19. <li>{{ path | replace('.html', '') | upper }}</li>
  20. {% else %}
  21. <li><a href="{{ url_for(link) }}/">{{ path | upper }}</a></li>
  22. {%- endif %}
  23. {%- endif %}
  24. {%- endif %}
  25. {%- endfor %}
  26. </ul>
  27. {%- endif %}