--- const pathname = new URL(Astro.request.url).pathname; const currentPath = pathname.slice(1); const links = [ { name: "Home", href: "/", path: "" }, { name: "About", href: "/about", path: "about" }, { name: "Projects", href: "/projects", path: "projects" }, { name: "Writing", href: "/writing", path: "writing" }, ]; const isPathActive = (currentPath: string, pathToCheck: string) => { if (pathToCheck === "") { return currentPath === pathToCheck; } return currentPath.startsWith(pathToCheck); }; ---