butter-portal/app/templates/breadcrumbs.html

16 lines
730 B
HTML
Raw Normal View History

<div class="breadcrumbs">
<nav class="breadcrumb" aria-label="breadcrumbs">
2026-03-06 08:51:31 +00:00
{% set ns = namespace(crumb_path="")%}
{# We use a namespace since jinja 2 variables cannot persist outside loops
The crumb_path var dynamically constructs urls for each breadcrumb based on request.path (removing the trailing slash),
We need to do this for the file viewer, as it can have many nested directories, but works for all other pages. #}
<ul>
{% set breadcrumbs = request.path[1:].split('/') %} {# request.path starts with / #}
{% for crumb in breadcrumbs %}
{% set ns.crumb_path = ns.crumb_path + "/" +crumb %}
<li><a href="{{ ns.crumb_path }}">{{crumb}}</a></li>
{% endfor %}
</ul>
</nav>
</div>