fix: modify sidebar link active conditions (needs to be the same page URL) (#1153)

Sidebar link active conditions - needs to be the same page
This commit is contained in:
Aradiel
2025-11-01 21:41:10 +01:00
committed by GitHub
parent 0b22c0a293
commit 5a10223f4c
+1 -1
View File
@@ -60,7 +60,7 @@
<ol class="menu" id="main-menu"> <ol class="menu" id="main-menu">
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }} {{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class='current' {{ end }}> <li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}> <a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
{{ $icon := default .Pre .Params.Icon }} {{ $icon := default .Pre .Params.Icon }}