Fix path prefix handling for "/"

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-03-14 12:04:50 +01:00
parent 143917cfe0
commit dee41028f7

View file

@ -162,10 +162,7 @@ const getPathPrefix = (path: string) => {
}
const pagePath = allPages.find((p) => path.endsWith(p.path))?.path;
if (pagePath === undefined) {
throw new Error(`Could not find base path for ${path}`);
}
return path.slice(0, path.length - pagePath.length);
return path.slice(0, path.length - (pagePath || "").length);
};
const navLinkXPadding = "md";