diff --git a/docs/.vuepress/markdown/createSidebar.js b/docs/.vuepress/markdown/createSidebar.js index a572ae8909405029861fe8e2075e8d87fc9688bb..d414f44c488fda629df4ade0a2e05f9739a81946 100644 --- a/docs/.vuepress/markdown/createSidebar.js +++ b/docs/.vuepress/markdown/createSidebar.js @@ -7,7 +7,7 @@ const createSiteMap = require('./createSiteMap'); const links = [] -function parseBar(file, options) { +function parseBar(tab, file, options) { const textName = options.text || 'text' const linkName = options.link || 'link' const contents = [] @@ -39,6 +39,13 @@ function parseBar(file, options) { }) if (link && !isExternal(link)) { + if (!link.startsWith('/')) { + const linkFirstItem = link.split('/')[0] + if (tab.indexOf(linkFirstItem) === -1) { + link = `${tab}${link}` + } + } + link = path.join('/', link.replace(/\.md\b/, '') .replace(/\bREADME\b/, '') .replace(/\/index/, '/') @@ -64,7 +71,7 @@ module.exports = function (tabs = []) { const sidebar = {} tabs.forEach(tab => { - sidebar[tab] = parseBar(path.join(__dirname, '../../', tab, '_sidebar.md'), { + sidebar[tab] = parseBar(tab, path.join(__dirname, '../../', tab, '_sidebar.md'), { text: 'title', link: 'path' }) diff --git a/docs/uniCloud/_sidebar.md b/docs/uniCloud/_sidebar.md index e6066b1c1c938d2b478f9f1c89d00592b63969a1..6503de7feb1c938977efe93e076f15f8191ec793 100644 --- a/docs/uniCloud/_sidebar.md +++ b/docs/uniCloud/_sidebar.md @@ -50,7 +50,7 @@ * [费用说明](uniCloud/redis-buy.md) * [开发文档](uniCloud/redis.md) * Push扩展库(socket) - * [业务文档](unipush-v2.md) + * [业务文档](/unipush-v2.md) * [开发文档](uniCloud/uni-cloud-push/api.md) * [uni-push2.0、uni-id、uni统计的组合](uniCloud/uni-cloud-push/mate.md) * [扩展参数](uniCloud/uni-cloud-push/options.md)