Skip to content

Instantly share code, notes, and snippets.

@eeshangarg
Created March 24, 2017 23:58
Show Gist options
  • Save eeshangarg/5ed8f9489563704cfe7edb8e4e2710d8 to your computer and use it in GitHub Desktop.
Save eeshangarg/5ed8f9489563704cfe7edb8e4e2710d8 to your computer and use it in GitHub Desktop.
Breadcrumb in Lektor using Bootstrap
<ol class="breadcrumb">
{% set crumbs = [] %}
{% set current = {'crumb': this} %}
{% for i in this._path.split("/") %}
{% if current.crumb is not none %}
{% if crumbs.insert(0, current.crumb) %}{% endif %}
{% if current.update({"crumb": current.crumb.parent}) %}{% endif %}
{% endif %}
{% endfor %}
{% for crumb in crumbs %}
{% if this._path == crumb._path %}
<li class="active">{{ crumb.title }}</li>
{% else %}
<li><a href="{{ crumb|url }}">{{ crumb.title }}</a></li>
{% endif %}
{% endfor %}
</ol>
@animeshkrishnabulusu
Copy link

This is great! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment