From ec5066bdb57e8927150cb9e1b37ad0cedb047716 Mon Sep 17 00:00:00 2001
From: Kris - The Coding Unicorn <47773700+guidemetothemoon@users.noreply.github.com>
Date: Sat, 30 Apr 2022 10:08:01 +0000
Subject: [PATCH] fix: apply active class to submenu items (#350)

---
 layouts/partials/navbar.html |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html
index eeb29aa..6dec190 100644
--- a/layouts/partials/navbar.html
+++ b/layouts/partials/navbar.html
@@ -22,21 +22,23 @@
           <li class="nav__list-item">
             <div class="optionswitch">
               <input class="optionswitch__picker" type="checkbox" id="menuoptionpicker" hidden />
-              <label
-                {{ range .Children }}
-                  {{ if in $current.RelPermalink .URL }}
-                    class="optionswitch__label nav__link--active"
 
-                  {{ else }}
-                    class="optionswitch__label"
-
-                  {{ end }}
+              {{ $labelClass := "optionswitch__label" }}
+              {{ range .Children }}
+                {{ if eq $url .URL }}
+                  {{ $labelClass = "optionswitch__label nav__link--active" }}
 
 
                 {{ end }}
-                for="menuoptionpicker"
+
+
+              {{ end }}
+
+
+              <label class="{{ $labelClass }}" for="menuoptionpicker"
                 >{{ .Name }} <i class="fa fa-angle-down" aria-hidden="true"></i
               ></label>
+
               <div class="optionswitch__triangle"></div>
               <ul class="optionswitch__list">
                 {{ range .Children }}

--
Gitblit v1.10.0