提交 8ff0f9dc 编写于 作者: hbcui1984's avatar hbcui1984

Merge branch 'master' of https://github.com/dcloudio/unidocs-zh

......@@ -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'
})
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册