This commit is contained in:
2025-08-20 15:57:59 -04:00
parent a13cbabdb4
commit 1528931a29
8 changed files with 68 additions and 52 deletions

View File

@@ -41,7 +41,11 @@ const currentPath = Astro.url.pathname;
const isExternal = item.href?.startsWith("http");
const isAuthedPath = item.auth ?? false;
const normalize = (url) => url?.replace(/\/+$/, '') || '/';
const isActive = !isExternal && normalize(item.href) === normalize(currentPath);
const normalizedCurrent = normalize(currentPath).replace(/\/$/, ""); // remove trailing slash
const normalizedHref = normalize(item.href).replace(/\/$/, "");
const isActive = !isExternal && (
normalizedCurrent === normalizedHref ||
normalizedCurrent.startsWith(normalizedHref + "/"));
const nextItem = navItems[index + 1];
const shouldShowThinBar = nextItem //&& !nextItem.blockSeparator;