2025-2-26-fixed
This commit is contained in:
41
themes/next/layout/_partials/header/brand.swig
Normal file
41
themes/next/layout/_partials/header/brand.swig
Normal file
@ -0,0 +1,41 @@
|
||||
<div class="site-brand-container">
|
||||
<div class="site-nav-toggle">
|
||||
<div class="toggle" aria-label="{{ __('accessibility.nav_toggle') }}">
|
||||
<span class="toggle-line toggle-line-first"></span>
|
||||
<span class="toggle-line toggle-line-middle"></span>
|
||||
<span class="toggle-line toggle-line-last"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="site-meta{%- if theme.custom_logo %} custom-logo{%- endif %}">
|
||||
{%- if theme.custom_logo and theme.scheme === 'Muse' %}
|
||||
<div class="site-meta-headline">
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo }}" alt="{{ title }}">
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<a href="{{ config.root }}" class="brand" rel="start">
|
||||
<span class="logo-line-before"><i></i></span>
|
||||
<h1 class="site-title">{{ title }}</h1>
|
||||
<span class="logo-line-after"><i></i></span>
|
||||
</a>
|
||||
{%- if subtitle %}
|
||||
<p class="site-subtitle" itemprop="description">{{ subtitle }}</p>
|
||||
{%- endif %}
|
||||
{%- if theme.custom_logo and (theme.scheme === 'Gemini' or theme.scheme === 'Pisces') %}
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo }}" alt="{{ title }}">
|
||||
</a>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
<div class="site-nav-right">
|
||||
<div class="toggle popup-trigger">
|
||||
{%- if theme.algolia_search.enable or theme.local_search.enable %}
|
||||
<i class="fa fa-search fa-fw fa-lg"></i>
|
||||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
7
themes/next/layout/_partials/header/index.swig
Normal file
7
themes/next/layout/_partials/header/index.swig
Normal file
@ -0,0 +1,7 @@
|
||||
{{ partial('_partials/header/brand.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{ partial('_partials/header/menu.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{ partial('_partials/search/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{- next_inject('header') }}
|
||||
34
themes/next/layout/_partials/header/menu-item.swig
Normal file
34
themes/next/layout/_partials/header/menu-item.swig
Normal file
@ -0,0 +1,34 @@
|
||||
{% macro render(name, itemName, value) %}
|
||||
|
||||
{%- set itemURL = value.split('||')[0] | trim %}
|
||||
{%- if not itemURL.startsWith('http') %}
|
||||
{%- set itemURL = itemURL | replace('//', '/') %}
|
||||
{%- endif %}
|
||||
<li class="menu-item menu-item-{{ itemName | replace(' ', '-') }}">
|
||||
|
||||
{%- set menuIcon = '' %}
|
||||
{%- if theme.menu_settings.icons %}
|
||||
{%- set menuIcon = '<i class="' + value.split('||')[1] | trim + ' fa-fw"></i>' %}
|
||||
{%- endif %}
|
||||
{%- set menuText = __('menu.' + name) | replace('menu.', '') %}
|
||||
|
||||
{%- set menuBadge = '' %}
|
||||
{%- if theme.menu_settings.badges %}
|
||||
{%- set badges = {
|
||||
archives : site.posts.length,
|
||||
categories: site.categories.length,
|
||||
tags : site.tags.length
|
||||
}
|
||||
%}
|
||||
{%- for menu, count in badges %}
|
||||
{%- if name == menu %}
|
||||
{%- set menuBadge = '<span class="badge">' + count + '</span>' %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
{{ next_url(itemURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}
|
||||
|
||||
</li>
|
||||
|
||||
{% endmacro %}
|
||||
34
themes/next/layout/_partials/header/menu.swig
Normal file
34
themes/next/layout/_partials/header/menu.swig
Normal file
@ -0,0 +1,34 @@
|
||||
{% import 'menu-item.swig' as menu_item with context %}
|
||||
|
||||
<nav class="site-nav">
|
||||
{%- if theme.menu %}
|
||||
<ul id="menu" class="main-menu menu">
|
||||
{%- for name, path in theme.menu %}
|
||||
{%- set respath = path %}
|
||||
{%- if path == '[object Object]' %}
|
||||
{# Main Menu (default menu item for Submenu) #}
|
||||
{%- for subname, subpath in path %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- set respath = subpath %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set itemName = name | lower %}
|
||||
{{ menu_item.render(name, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% else %}
|
||||
{# Main Menu (standard menu items) #}
|
||||
{%- set itemName = name | lower %}
|
||||
{{- menu_item.render(name, itemName, respath) | trim }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- if theme.algolia_search.enable or theme.local_search.enable %}
|
||||
<li class="menu-item menu-item-search">
|
||||
<a role="button" class="popup-trigger">
|
||||
{%- if theme.menu_settings.icons %}<i class="fa fa-search fa-fw"></i>{%- endif %}{{ __('menu.search') }}
|
||||
</a>
|
||||
</li>
|
||||
{%- endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
</nav>
|
||||
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