Skip to content

Instantly share code, notes, and snippets.

@budparr
Created November 10, 2015 18:02
Show Gist options
  • Save budparr/89491ffb8335cb5aed89 to your computer and use it in GitHub Desktop.
Save budparr/89491ffb8335cb5aed89 to your computer and use it in GitHub Desktop.
{% comment %}
*
* http://stackoverflow.com/questions/9612235/what-are-some-good-ways-to-implement-breadcrumbs-on-a-jekyll-site
*
{% endcomment %}
<nav class="breadcrumbs" role="menubar" aria-label="breadcrumbs">
<a href="{{ site.url }}">{{ site.data.language.breadcrumb_start }}</a>
{% assign crumbs = page.url | split: '/' %}
{% for crumb in crumbs offset: 1 %}
{% if forloop.last %}
<a class="current">{{ page.title }}</a>
{% else %}
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment