mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
feat(v2): generate sitemap (#1065)
* feat(v2): generate sitemap * cannot snapshot sitemap because xml generated in different order
This commit is contained in:
parent
8663a63e7d
commit
fd780f19a2
18 changed files with 127 additions and 1185 deletions
|
@ -4,6 +4,7 @@ const chalk = require('chalk');
|
|||
const fs = require('fs-extra');
|
||||
const globby = require('globby');
|
||||
const load = require('../load');
|
||||
const createSitemap = require('../core/sitemap');
|
||||
const createServerConfig = require('../webpack/server');
|
||||
const createClientConfig = require('../webpack/client');
|
||||
const {applyConfigureWebpack} = require('../webpack/utils');
|
||||
|
@ -67,6 +68,11 @@ module.exports = async function build(siteDir) {
|
|||
}),
|
||||
);
|
||||
|
||||
// generate sitemap
|
||||
const sitemap = await createSitemap(props);
|
||||
const sitemapPath = path.join(outDir, 'sitemap.xml');
|
||||
await fs.writeFile(sitemapPath, sitemap);
|
||||
|
||||
const relativeDir = path.relative(process.cwd(), outDir);
|
||||
console.log(
|
||||
`\n${chalk.green('Success!')} Generated static files in ${chalk.cyan(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue