File tree 3 files changed +26
-12
lines changed
3 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -229,9 +229,14 @@ module.exports = {
229
229
// Customising the header label
230
230
// Defaults to "GitHub"/"GitLab"/"Bitbucket" depending on `themeConfig.repo`
231
231
repoLabel: ' Contribute!' ,
232
- // if your docs are not at the root of the repo
232
+
233
+ // Optional options for generating "Edit this page" link
234
+
235
+ // if your docs are in a different repo from your main project:
236
+ docsRepo: ' vuejs/vuepress' ,
237
+ // if your docs are not at the root of the repo:
233
238
docsDir: ' docs' ,
234
- // optional, defaults to master
239
+ // if your docs are in a specific branch ( defaults to ' master'):
235
240
docsBranch: ' master' ,
236
241
// defaults to true, set to false to disable
237
242
editLinks: true ,
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ next: false
214
214
---
215
215
```
216
216
217
- ## Github 和编辑链接
217
+ ## Git 仓库和编辑链接
218
218
219
219
当你提供了 ` themeConfig.repo ` 选项,将会自动在每个页面的导航栏生成生成一个 GitHub 链接,以及在页面的底部生成一个 ` "Edit this page" ` 链接。
220
220
@@ -224,10 +224,18 @@ module.exports = {
224
224
themeConfig: {
225
225
// 假定是 GitHub. 同时也可以是一个完整的 GitLab URL
226
226
repo: ' vuejs/vuepress' ,
227
- // 当你的文档不是仓库的根目录时需要设置
228
- docsDir: ' docs' ,
229
- // 可选的, 默认是 master
230
- docsBranch: ' master' ,
227
+ // 自定义仓库链接文字。默认从 `themeConfig.repo` 中自动推断为
228
+ // "GitHub"/"GitLab"/"Bitbucket" 其中之一,或是 "Source"。
229
+ repoLabel: ' 查看源码' ,
230
+
231
+ // 以下为可选的编辑链接选项
232
+
233
+ // 假如你的文档仓库和项目本身不在一个仓库:
234
+ docsRepo: ' vuejs/vuepress' ,
235
+ // 假如文档不是放在仓库的根目录下:
236
+ docsDir: ' docs' ,
237
+ // 假如文档放在一个特定的分支下:
238
+ docsBranch: ' master' ,
231
239
// 默认是 true, 设置为 false 来禁用
232
240
editLinks: true ,
233
241
// 默认为 "Edit this page"
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ export default {
55
55
repo ,
56
56
editLinks ,
57
57
docsDir = ' ' ,
58
- docsBranch = ' master'
58
+ docsBranch = ' master' ,
59
+ docsRepo = repo
59
60
} = this .$site .themeConfig
60
61
61
62
let path = normalize (this .$page .path )
@@ -65,10 +66,10 @@ export default {
65
66
path += ' .md'
66
67
}
67
68
68
- if (repo && editLinks) {
69
- const base = outboundRE .test (repo )
70
- ? repo
71
- : ` https://github.com/${ repo } `
69
+ if (docsRepo && editLinks) {
70
+ const base = outboundRE .test (docsRepo )
71
+ ? docsRepo
72
+ : ` https://github.com/${ docsRepo } `
72
73
return (
73
74
base .replace (endingSlashRE, ' ' ) +
74
75
` /edit/${ docsBranch} /` +
You can’t perform that action at this time.
0 commit comments