-
Notifications
You must be signed in to change notification settings - Fork 8
/
breadcrumbs.drupal.liquid
49 lines (47 loc) · 2.08 KB
/
breadcrumbs.drupal.liquid
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<nav data-template="includes/breadcrumbs" aria-label="Breadcrumb" aria-live="polite" class="va-nav-breadcrumbs"
id="va-breadcrumbs">
<ul class="row va-nav-breadcrumbs-list columns" id="va-breadcrumbs-list">
{% assign crumbs = entityUrl.breadcrumb %}
{% if deriveBreadcrumbsFromUrl == true %}
{% assign crumbs = entityUrl.breadcrumb | deriveLastBreadcrumbFromPath: title, entityUrl.path, replaceLastItem %}
{% endif %}
{% if constructLcBreadcrumbs == true %}
{% assign crumbs = entityUrl.breadcrumb | deriveLcBreadcrumbs: title, entityUrl.path, titleInclude %}
{% endif %}
{% for crumb in crumbs %}
{% if forloop.last == true %}
<li>
<a
onclick="recordEvent({ 'event': 'nav-breadcrumb', 'breadcrumb-click-label': '{{ crumb.text }}', 'breadcrumb-click-level': '{{ forloop.index }}', 'breadcrumb-total-levels': '{{ crumbs.length }}' });"
aria-current="page"
href="/{{ path }}"
>
{{ crumb.text }}
</a>
</li>
{% elsif crumb.url.path %}
{% if crumb.url.path == '/' %}
{% if hideHomeBreadcrumb != true %}
{% if customHomeCrumbText != empty %}
<li>
<a href="{{ crumb.url.path }}"
onclick="recordEvent({ event: 'nav-breadcrumb', 'nav-breadcrumb-section': 'home' });">{{ customHomeCrumbText }}
</a>
</li>
{% else %}
<li>
<a href="{{ crumb.url.path }}"
onclick="recordEvent({ event: 'nav-breadcrumb', 'nav-breadcrumb-section': 'home' });">{{ crumb.text }}
</a>
</li>
{% endif %}
{% endif %}
{% else %}
<li><a
onclick="recordEvent({ 'event': 'nav-breadcrumb', 'breadcrumb-click-label': '{{ crumb.text }}', 'breadcrumb-click-level': '{{ forloop.index }}', 'breadcrumb-total-levels': '{{ crumbs.length }}' });"
href="{{ crumb.url.path }}">{{ crumb.text }}</a></li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</nav>