🐛 Fixed the children menus links.

This commit is contained in:
elkan1788
2025-01-30 15:35:21 +08:00
parent 3bffe42e3e
commit af3de3609d
3 changed files with 39 additions and 20 deletions

View File

@@ -3,7 +3,7 @@
<nav class="site-nav">
<ul class="main-menu menu">
{{ range .Site.Menus.main }}
{{ $active := $curP.IsMenuCurrent "main" . }}
{{ $active := $curP.IsMenuCurrent .Menu . }}
<li class="menu-item menu-item-{{ .Identifier }}">
<a href="{{ .URL | relLangURL }}" class="{{ if .HasChildren }}menus-parent{{ end }} hvr-icon-pulse {{if $active }} menu-item-active{{ end }}" rel="section">
{{ if $ms.icons }}<i class="fa fa-{{ .Pre }} hvr-icon"></i>{{ end }}{{ .Name }}
@@ -15,9 +15,9 @@
{{ if .HasChildren }}
<ul class="menu-children">
{{ range .Children }}
{{ $active = $curP.IsMenuCurrent "main" . }}
{{ $active = or ($curP.IsMenuCurrent .Menu .) ($curP.HasMenuCurrent .Menu .) }}
<li class="menu-child-item">
<a href="{{ .URL | relLangURL }}" class="hvr-icon-pulse {{if $active }}menu-item-active{{ end }}" rel="section">
<a href="{{ .PageRef | relLangURL }}" class="hvr-icon-pulse {{if $active }}menu-item-active{{ end }}" rel="section">
<i class="fa hvr-icon"></i>{{ .Name }}
</a>
</li>