diff --git a/scripts/build-pages/index.ts b/scripts/build-pages/index.ts index 26f0a345506..a060ac83c4a 100644 --- a/scripts/build-pages/index.ts +++ b/scripts/build-pages/index.ts @@ -73,7 +73,7 @@ function patchPage(page: Page): Page { href: `#${heading.getAttribute('id')}` })); - const pageClass = `page-${slugify(page.path.slice(6))}`; + const pageClass = `page-${slugify(page.path.slice(6) || 'index')}`; return { ...page, @@ -90,4 +90,4 @@ function writePage(page: Page): Promise { } const toFilePath = (urlPath: string) => - `${resolve(PAGES_DIR, urlPath.slice(6))}.json`; + `${resolve(PAGES_DIR, urlPath.slice(6) || 'index')}.json`; diff --git a/scripts/build-pages/page-types/static.ts b/scripts/build-pages/page-types/static.ts index 2ccbdbfe621..edfc2c1a3e5 100644 --- a/scripts/build-pages/page-types/static.ts +++ b/scripts/build-pages/page-types/static.ts @@ -29,7 +29,7 @@ const getMarkdownPaths = (cwd: string): Promise => export const toPage = async (path: string) => { return { - path: path.replace(PAGES_DIR, '/docs').replace(/\.md$/, ''), + path: path.replace(PAGES_DIR, '/docs').replace(/(\/index)?\.md$/i, ''), github: await getGitHubData(path), ...renderMarkdown(await readMarkdown(path)) };