From 3ca1a67416faa0289d9e84d3afc48cee5c5b9936 Mon Sep 17 00:00:00 2001
From: DCloud_LXH <283700113@qq.com>
Date: Mon, 11 Dec 2023 17:27:41 +0800
Subject: [PATCH] feat: create sitemap
---
docs/.vuepress/markdown/createSidebar.js | 2 +-
docs/.vuepress/markdown/createSiteMap.js | 3 ++-
package.json | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/docs/.vuepress/markdown/createSidebar.js b/docs/.vuepress/markdown/createSidebar.js
index ca5ac691..10c5654f 100644
--- a/docs/.vuepress/markdown/createSidebar.js
+++ b/docs/.vuepress/markdown/createSidebar.js
@@ -46,7 +46,7 @@ function parseBar(tab, file, options) {
}
}
- link = path.join('/', link.replace(/\.md\b/, '.html')
+ link = path.join('/', link.replace(/\.md\b/, '')
.replace(/\bREADME\b/, '')
.replace(/\/index/, '/')
.replace(/\?id=/, '#'))
diff --git a/docs/.vuepress/markdown/createSiteMap.js b/docs/.vuepress/markdown/createSiteMap.js
index 28343a25..b3d54e7e 100644
--- a/docs/.vuepress/markdown/createSiteMap.js
+++ b/docs/.vuepress/markdown/createSiteMap.js
@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')
-const domain = 'https://zh.uniapp.dcloud.io'
+const domain = 'https://doc.dcloud.net.cn'
const xmlBefore = `
`
@@ -9,6 +9,7 @@ const xmlAfter = `\n`
module.exports = (links, callback = () => { }) => {
const xmlItems = links.map(url => {
+ if (!url.endsWith('/') && !url.endsWith('html')) url += '.html'
return `
${domain + url}
`
diff --git a/package.json b/package.json
index 05bfde36..79852adb 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "unidocs-uni-app-x-zh-zh",
+ "name": "unidocs-uni-app-x-zh",
"version": "1.0.0",
"description": "",
"main": "index.js",
--
GitLab