diff --git a/src/node/server.ts b/src/node/server.ts index 644d041a..1b3f7c2d 100644 --- a/src/node/server.ts +++ b/src/node/server.ts @@ -145,9 +145,14 @@ function getNextAndPrev(themeConfig: any, pagePath: string) { if (!sidebarItem.children) { return } - sidebarItem.children.forEach((candidate: any) => { - candidates.push(candidate) - }) + sidebarItem.children.forEach( + (candidate: { text: string; link: string }) => { + candidates.push({ + text: candidate.text, + link: convertToAbsolutePath(candidate.link) + }) + } + ) }) }) @@ -166,6 +171,13 @@ function getNextAndPrev(themeConfig: any, pagePath: string) { } } +function convertToAbsolutePath(path: string) { + if (!path.startsWith('/')) { + return `/${path}` + } + return path +} + export async function createServer(options: ServerConfig = {}) { const config = await resolveConfig(options.root)