diff --git a/lib/build.js b/lib/build.js index 149f9f93a0..44c6585e3e 100644 --- a/lib/build.js +++ b/lib/build.js @@ -63,12 +63,22 @@ module.exports = async function build (sourceDir, cliOptions = {}) { .map(renderHeadTag) .join('\n ') - // render pages console.log('Rendering static HTML...') + + // render pages from md files for (const page of options.siteData.pages) { await renderPage(page) } + // render extra pages + const extraPages = [ + ...(options.siteConfig.themeConfig.extraPages || []), + ...(options.siteConfig.extraPages || []) + ] + for (const path of extraPages) { + await renderPage({ path }) + } + // if the user does not have a custom 404.md, generate the theme's default if (!options.siteData.pages.some(p => p.path === '/404.html')) { await renderPage({ path: '/404.html' }) @@ -153,7 +163,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) { console.error(chalk.red(`Error rendering ${pagePath}:`)) throw e } - const filename = pagePath.replace(/\/$/, '/index.html').replace(/^\//, '') + const filename = pagePath.replace(/(\/$)|((?