nicer code for breadcrumb
This commit is contained in:
parent
c95257cadc
commit
58d01e6ed3
2 changed files with 8 additions and 5 deletions
|
@ -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>
|
||||
|
|
|
@ -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 %}
|
||||
|
||||
|
|
Reference in a new issue