/
breadcrumbs.html
32 lines (31 loc) · 1.1 KB
/
breadcrumbs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{# Displays (and links to) the parent section(s) of the currently viewed page. #}
{%- block breadcrumbs %}
{#
If we have more than 3 parents (excluding the home page) then we remove
The ones in the middle and add an ellipsis.
#}
{% if parents|length>2 %}
{% set parents=[parents[0], {"title": '<i class="fa-solid fa-ellipsis"></i>'}, parents[-1]] %}
{% endif %}
{#- Hide breadcrumbs on the home page #}
{% if title and pagename != root_doc %}
<nav aria-label="{{ _('Breadcrumb') }}">
<ul class="bd-breadcrumbs">
{# Home icon #}
<li class="breadcrumb-item breadcrumb-home">
<a href="{{ pathto(root_doc) }}" class="nav-link" aria-label="{{ _('Home') }}">
<i class="fa-solid fa-home"></i>
</a>
</li>
{%- for doc in parents %}
{% if doc.link %}
<li class="breadcrumb-item"><a href="{{ doc.link|e }}" class="nav-link">{{ doc.title }}</a></li>
{% else %}
<li class="breadcrumb-item">{{ doc.title }}</li>
{% endif %}
{%- endfor %}
<li class="breadcrumb-item active" aria-current="page">{{ title|truncate(15, False) }}</li>
</ul>
</nav>
{% endif %}
{%- endblock %}