From e6c070cc59708522e791c5a2569f6776dca4666b Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 21 Jul 2022 18:24:28 +0800 Subject: [PATCH] chore: createSiteMap --- docs/.vuepress/markdown/createSiteMap.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/.vuepress/markdown/createSiteMap.js b/docs/.vuepress/markdown/createSiteMap.js index 6d11a3a96..a9c974d5a 100644 --- a/docs/.vuepress/markdown/createSiteMap.js +++ b/docs/.vuepress/markdown/createSiteMap.js @@ -14,8 +14,12 @@ module.exports = (links, callback = () => { }) => { ` }).join('\n') + const rootPath = path.resolve(__dirname, '../../../root') + const staticExists = fs.existsSync(rootPath) + if (!staticExists) fs.mkdirSync(rootPath) + fs.writeFile( - path.resolve(__dirname, '../../../root/sitemap.xml'), + path.resolve(rootPath, 'sitemap.xml'), xmlBefore + xmlItems + xmlAfter, { encoding: 'utf-8' }, callback -- GitLab