From 3b2fac133a416163b96a9a243fc13dc028b92beb Mon Sep 17 00:00:00 2001 From: codey Date: Thu, 17 Jul 2025 10:43:50 -0400 Subject: [PATCH] bugfix: navbar active link matching --- src/components/Nav.astro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Nav.astro b/src/components/Nav.astro index c3cf0ae..b628364 100644 --- a/src/components/Nav.astro +++ b/src/components/Nav.astro @@ -39,7 +39,9 @@ const currentPath = Astro.url.pathname; } const isExternal = item.href?.startsWith("http"); - const isActive = !isExternal && item.href === currentPath; + const normalize = (url) => url?.replace(/\/+$/, '') || '/'; + const isActive = !isExternal && normalize(item.href) === normalize(currentPath); + const nextItem = navItems[index + 1]; const shouldShowThinBar = nextItem && !nextItem.blockSeparator;