commit dd4300733cd505681b40ae1be212148d0094ce9a Author: gus gus@torproject.org Date: Mon May 4 22:40:53 2020 -0400
Fix breadcrumb for lektor and bootstrap. Thanks @eeshangarg --- templates/breadcrumb.html | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/templates/breadcrumb.html b/templates/breadcrumb.html index 735d915..34ab2e5 100644 --- a/templates/breadcrumb.html +++ b/templates/breadcrumb.html @@ -1,7 +1,19 @@ <nav aria-label="breadcrumb"> - <ol class="breadcrumb bg-light m-0 small"> - {% from "macros/parent.html" import render_parents %} - {{ render_parents(this) }} - <li class="breadcrumb-item active" aria-current="page">{{ this.title }}</li> - </ol> +<ol class="breadcrumb bg-light m-0 small"> + {% 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="breadcrumb-item active">{{ crumb.title }}</li> + {% else %} + <li class="breadcrumb-item" aria-current="page"><a href="{{ crumb|url }}">{{ crumb.title }}</a></li> + {% endif %} + {% endfor %} +</ol> </nav>
tor-commits@lists.torproject.org