forked from getgrav/grav-plugin-breadcrumbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
breadcrumbs.html.twig
38 lines (37 loc) · 1.74 KB
/
breadcrumbs.html.twig
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
{% set crumbs = breadcrumbs.get() %}
{% set breadcrumbs_config = config.plugins.breadcrumbs %}
{% set divider = breadcrumbs_config.icon_divider_classes %}
{% if crumbs|length > 1 or breadcrumbs_config.show_all %}
<div id="breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">
{% if breadcrumbs_config.icon_home %}
<i class="{{ breadcrumbs_config.icon_home }}"></i>
{% endif %}
{% for crumb in crumbs %}
<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
{% if not loop.last %}
{% if crumb.routable %}
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="{{ crumb.url|e }}" itemid="{{ crumb.url|e }}">
<span itemprop="name">{{ crumb.menu|e }}</span>
</a>
{% else %}
<span itemscope itemtype="http://schema.org/Thing" itemprop="item" itemid="{{ crumb.url|e }}">
<span itemprop="name">{{ crumb.menu|e }}</span>
</span>
{% endif %}
<i class="{{ divider }}"></i>
{% else %}
{% if breadcrumbs_config.link_trailing %}
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="{{ crumb.url|e }}" itemid="{{ crumb.url|e }}">
<span itemprop="name">{{ crumb.menu|e }}</span>
</a>
{% else %}
<span itemscope itemtype="http://schema.org/Thing" itemprop="item" itemid="{{ crumb.url|e }}">
<span itemprop="name">{{ crumb.menu|e }}</span>
</span>
{% endif %}
{% endif %}
<meta itemprop="position" content="{{ loop.index }}" />
</span>
{% endfor %}
</div>
{% endif %}