Skip to content

Commit 36c1896

Browse files
authored
Merge pull request theme-next#497 from JiangTJ/fix-same-submenu
fix submenu when path name is same
2 parents 016b3a0 + 5a751c6 commit 36c1896

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

layout/_partials/breadcrumb.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
{% if current == count - 1 %}
1111
<li>{{ path | upper }}</li>
1212
{% else %}
13-
<li><a href="{{ link }}{{ url_for(path) }}/">{{ path | upper }}</a></li>
1413
{% if link == '' %}
1514
{% set link = '/' + path %}
1615
{% else %}
1716
{% set link += '/' + path %}
1817
{% endif %}
18+
<li><a href="{{ url_for(link) }}/">{{ path | upper }}</a></li>
1919
{% endif %}
2020
{% endif %}
2121
{% endfor %}

layout/_partials/header/sub-menu.swig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656

5757
{# If current URL is value of parent submenu 'default' path #}
5858
{% set paths = page.path.split('/') %}
59-
{% for currentSubParentUrl in paths %}
60-
{% if currentSubParentUrl == subvalue.default.split('||')[0] | trim | replace('/', '', 'g') %}
59+
{% if paths.length > 2 %}
60+
{% if paths[1] == subvalue.default.split('||')[0] | trim | replace('/', '', 'g') %}
6161

6262
{# Submenu-2 items #}
6363
<ul id="sub-menu-2" class="sub-menu menu">
@@ -79,7 +79,7 @@
7979
{# End Submenu-2 items #}
8080

8181
{% endif %}
82-
{% endfor %}
82+
{% endif %}
8383
{# End URL & path comparing #}
8484

8585
{% endif %}

0 commit comments

Comments
 (0)