[tor-commits] [lego/master] Update to breadcrumbs

hiro at torproject.org hiro at torproject.org
Thu Sep 12 15:37:24 UTC 2019


commit 97194ff8adaa0c9f9a59515a016215b87c7550e7
Author: hiro <hiro at torproject.org>
Date:   Thu Sep 12 17:36:58 2019 +0200

    Update to breadcrumbs
---
 templates/breadcrumb.html | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/templates/breadcrumb.html b/templates/breadcrumb.html
index ecb9f88..bf6ca88 100644
--- a/templates/breadcrumb.html
+++ b/templates/breadcrumb.html
@@ -1,18 +1,22 @@
 <nav aria-label="breadcrumb">
   <ol class="breadcrumb">
-    {% set parent = this.parent %}
-    {% for _ in range(1, 10) %}
-      {% if  parent.path == "/" %}
-        {% break %}
-      {% else %}
-        <li class="breadcrumb-item active" aria-current="page">
-          <a href="{{ parent.path|url }}">
-            {{ parent.title }}
-          </a>
-        </li>
-        {% set parent = parent.parent %}
-      {% endif %}
-    {% endfor %}
+    {% if this.parent %}
+      {% set parent = this.parent %}
+      {% for _ in range(1, 5) %}
+        {% if parent %}
+          {% if parent.path == "/" %}
+            {# break #}
+          {% else %}
+            <li class="breadcrumb-item active" aria-current="page">
+              <a href="{{ parent.path|url }}">
+                {{ parent.title }}
+              </a>
+            </li>
+            {% set parent = parent.parent %}
+          {% endif %}
+        {% endif %}
+      {% endfor %}
+    {% endif %}
     <li class="breadcrumb-item active" aria-current="page">{{ this.title }}</li>
   </ol>
 </nav>



More information about the tor-commits mailing list