1
0
Fork 0

nicer code for breadcrumb

This commit is contained in:
Moritz »mo.« Sauer 2015-02-27 17:10:01 +01:00
parent c95257cadc
commit 58d01e6ed3
2 changed files with 8 additions and 5 deletions

View file

@ -7,12 +7,11 @@
<nav class="breadcrumbs" role="menubar" aria-label="breadcrumbs">
<li><a href="{{ site.url }}">{{ site.data.language.breadcrumb_start }}</a></li>
{% assign crumbs = page.url | split: '/' %}
{% assign crumbs_total = crumbs | size | minus: 1 %}
{% for crumb in crumbs offset: 1 %}
{% if forloop.index == crumbs_total %}
{% if forloop.last %}
<li class="current">{{ page.title }}</li>
{% else %}
<li><a href="{{ site.url }}{% assign crumb_limit = forloop.index | plus: 1 %}{% for crumb in crumbs limit: crumb_limit %}{{ crumb | append: '/' }}{% endfor %}">{{ crumb | replace:'-',' ' }}</a>
{% endif %}
{% endfor %}
</nav>
</nav>

View file

@ -24,7 +24,9 @@
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% elsif link.url == '#' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url %}
{% endif %}
@ -76,7 +78,9 @@
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% elsif link.url == '#' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url %}
{% endif %}