[tor-commits] [lego/master] Update to breadcrumbs
hiro at torproject.org
hiro at torproject.org
Thu Sep 12 15:59:07 UTC 2019
commit d88cb2192648457ba42a8c91c762e3be7d0b89d0
Author: hiro <hiro at torproject.org>
Date: Thu Sep 12 17:59:04 2019 +0200
Update to breadcrumbs
---
templates/macros/parent.html | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/templates/macros/parent.html b/templates/macros/parent.html
index 278d470..d72db17 100644
--- a/templates/macros/parent.html
+++ b/templates/macros/parent.html
@@ -1,7 +1,20 @@
{% macro render_parents(item) %}
- <li class="breadcrumb-item active" aria-current="page">
- <a href="{{ item.parent.path|url }}">
- {{ item.parent.title }}
- </a>
- </li>
+
+ {% if item.parent %}
+ {% for _ in range(1, 5) %}
+ {% set parent = item.parent %}
+ {% if parent %}
+ {% if parent.path == "/" %}
+ {# break #}
+ {% else %}
+ <li class="breadcrumb-item active" aria-current="page">
+ <a href="{{ parent.path|url }}">
+ {{ parent.title }}
+ </a>
+ </li>
+ {% endif %}
+ {% endif %}
+ {% set item = item.parent %}
+ {% endfor %}
+ {% endif %}
{% endmacro %}
More information about the tor-commits
mailing list