1
0
Fork 0
This repository has been archived on 2021-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
dennogumi.org-archive/_includes/breadcrumb.html
Moritz »mo.« Sauer 54411d7f9b added breadcrumbs
2015-01-12 18:08:05 +01:00

31 lines
1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% comment %}
http://stackoverflow.com/questions/9612235/what-are-some-good-ways-to-implement-breadcrumbs-on-a-jekyll-site
https://github.com/huonw/huonw.github.io/blob/master/_layouts/default.html#L17
{% endcomment %}
{% capture url_parts %} {{ page.url | remove: "/index.html" | replace:'/'," " }}{% endcapture %}
{% capture num_parts %}{{ url_parts | number_of_words | minus: 1 }}{% endcapture %}
{% assign previous="" %}
<nav class="breadcrumbs" role="menubar" aria-label="breadcrumbs">
{% if num_parts == "0" or num_parts == "-1" %}
<a href="{{ site.url }}">Start</a>
{% else %}
<a href="{{ site.url }}">Start</a>
{% for unused in page.content limit:num_parts %}
{% capture first_word %}{{ url_parts | truncatewords:1 | remove:"..."}}{% endcapture %}
{% capture previous %}{{ previous }}/{{ first_word }}{% endcapture %}
<a href="{{previous}}">{{ first_word }}</a>
{% capture url_parts %}{{ url_parts | remove_first:first_word }}{% endcapture %}
{% endfor %}
{% endif %}
<a class="current" href="#">{{ page.title }}</a>
</nav>