16 lines
749 B
HTML
16 lines
749 B
HTML
|
|
<div class="breadcrumbs">
|
||
|
|
<nav class="breadcrumb" aria-label="breadcrumbs">
|
||
|
|
{% set ns = namespace(crumb_path=request.url_root[:-1])%}
|
||
|
|
{# 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>
|