another commit without a list of specific changes! (misc)
This commit is contained in:
@@ -40,12 +40,15 @@ const currentPath = Astro.url.pathname;
|
||||
|
||||
const isExternal = item.href?.startsWith("http");
|
||||
const isAuthedPath = item.auth ?? false;
|
||||
const normalize = (url) => url?.replace(/\/+$/, '') || '/';
|
||||
const normalizedCurrent = normalize(currentPath).replace(/\/$/, ""); // remove trailing slash
|
||||
const normalizedHref = normalize(item.href).replace(/\/$/, "");
|
||||
const normalize = (url) => (url || '/').replace(/\/+$/, '') || '/';
|
||||
const normalizedCurrent = normalize(currentPath);
|
||||
const normalizedHref = normalize(item.href);
|
||||
const isActive = !isExternal && (
|
||||
normalizedCurrent === normalizedHref ||
|
||||
normalizedCurrent.startsWith(normalizedHref + "/"));
|
||||
normalizedHref === '/'
|
||||
? normalizedCurrent === '/' // Home only matches exact /
|
||||
: normalizedCurrent === normalizedHref || normalizedCurrent.startsWith(normalizedHref + '/')
|
||||
);
|
||||
|
||||
|
||||
const nextItem = navItems[index + 1];
|
||||
const shouldShowThinBar = nextItem //&& !nextItem.blockSeparator;
|
||||
|
Reference in New Issue
Block a user