2025-2-26-fixed
This commit is contained in:
96
themes/next/layout/_partials/header/sub-menu.swig
Normal file
96
themes/next/layout/_partials/header/sub-menu.swig
Normal file
@ -0,0 +1,96 @@
|
||||
{% import '_partials/header/menu-item.swig' as menu_item with context %}
|
||||
|
||||
{%- if theme.menu and is_page() %}
|
||||
{# Submenu & Submenu-2 #}
|
||||
{%- for name, value in theme.menu %}
|
||||
{%- set respath = value %}
|
||||
{%- if value == '[object Object]' %}
|
||||
|
||||
{# If current URL is value of parent submenu 'default' path #}
|
||||
{%- set currentParentUrl = page.path.split('/')[0] | trim %}
|
||||
{%- if currentParentUrl == value.default.split('||')[0] | trim | replace('/', '') %}
|
||||
|
||||
{# Submenu items #}
|
||||
<ul id="sub-menu" class="sub-menu menu">
|
||||
{%- for subname, subvalue in value %}
|
||||
{# For main submenu items #}
|
||||
{%- if subvalue != '[object Object]' %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentValue = subvalue.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{%- if subvalue.startsWith('http') %}
|
||||
{%- set respath = subvalue %}
|
||||
{% else %}
|
||||
{%- set respath = parentValue + subvalue %}
|
||||
{%- endif %}
|
||||
{{ menu_item.render(subname, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{% else %}
|
||||
{# For 'default' submenu item in main submenu #}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- for subname2, subvalue2 in subvalue %}
|
||||
{%- if subname2 == 'default' %}
|
||||
{%- set respath = parentValue + subvalue2 %}
|
||||
{{ menu_item.render(subname, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{# End Submenu items #}
|
||||
|
||||
{# Submenu-2 #}
|
||||
{%- for name, value in theme.menu %}
|
||||
{%- set respath = value %}
|
||||
{%- if value == '[object Object]' %}
|
||||
|
||||
{%- for subname, subvalue in value %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentValue = subvalue.split('||')[0] | trim %}
|
||||
{%- endif %}
|
||||
{%- if subvalue == '[object Object]' %}
|
||||
|
||||
{# If current URL is value of parent submenu 'default' path #}
|
||||
{%- set paths = page.path.split('/') %}
|
||||
{%- if paths.length > 2 %}
|
||||
{%- if paths[1] == subvalue.default.split('||')[0] | trim | replace('/', '') %}
|
||||
|
||||
{# Submenu-2 items #}
|
||||
<ul id="sub-menu-2" class="sub-menu menu">
|
||||
{%- for subname2, subvalue2 in subvalue %}
|
||||
{%- set respath2 = subvalue %}
|
||||
{%- set itemName = subname2 | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentSubValue = subvalue2.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{%- if subvalue2.startsWith('http') %}
|
||||
{%- set respath2 = subvalue2 %}
|
||||
{% else %}
|
||||
{%- set respath2 = parentValue + parentSubValue + subvalue2 %}
|
||||
{%- endif %}
|
||||
{{ menu_item.render(subname2, itemName, respath2) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{# End Submenu-2 items #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{# End URL & path comparing #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{# End Submenu-2 #}
|
||||
|
||||
{%- endif %}
|
||||
{# End URL & path comparing #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{# End Submenu & Submenu-2 #}
|
||||
{%- endif %}
|
||||
Reference in New Issue
Block a user