hacks-guide-minimal-mistake.../_includes/breadcrumbs.html

25 lines
1.2 KiB
HTML
Raw Normal View History

<nav class="breadcrumbs">
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
{% assign crumbs = page.url | split: '/' %}
{% assign i = 1 %}
{% for crumb in crumbs offset: 1 %}
{% if forloop.first %}
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="{{ absurl }}/" itemprop="item"><span itemprop="name">{{ site.breadcrumb_home_label }}</span></a>
<meta itemprop="position" content="{{ i }}" />
</li>
<span class="sep">{{ site.breadcrumb_separator }}</span>
{% endif %}
{% if forloop.last %}
<li class="current">{{ page.title }}</li>
{% else %}
{% assign i = i | plus: 1 %}
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="{{ absurl }}{% assign crumb_limit = forloop.index | plus: 1 %}{% for crumb in crumbs limit: crumb_limit %}{{ crumb | append: '/' }}{% endfor %}" itemprop="item"><span itemprop="name">{{ crumb | replace: '-', ' ' | replace: '%20', ' ' | capitalize }}</span></a>
<meta itemprop="position" content="{{ i }}" />
</li>
<span class="sep">{{ site.breadcrumb_separator }}</span>
{% endif %}
{% endfor %}
</ol>
</nav>