bugfix: navbar active link matching
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user