Skip to content

Allow to use a different docs repo for edit-link #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/default-theme-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,16 @@ module.exports = {
// Customising the header label
// Defaults to "GitHub"/"GitLab"/"Bitbucket" depending on `themeConfig.repo`
repoLabel: 'Contribute!',
// if your docs are not at the root of the repo
// If your docs are placed at a different repo
// Default to `themeConfig.repo`
docsRepo: 'vuejs/vuejs.org',
// If your docs are not at the root of the repo
docsDir: 'docs',
// optional, defaults to master
// Optional, defaults to master
docsBranch: 'master',
// defaults to true, set to false to disable
// Defaults to true, set to false to disable
editLinks: true,
// custom text for edit link. Defaults to "Edit this page"
// Custom text for edit link. Defaults to "Edit this page"
editLinkText: 'Help us improve this page!'
}
}
Expand Down
11 changes: 6 additions & 5 deletions lib/default-theme/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export default {
repo,
editLinks,
docsDir = '',
docsBranch = 'master'
docsBranch = 'master',
docsRepo = repo
} = this.$site.themeConfig

let path = normalize(this.$page.path)
Expand All @@ -65,10 +66,10 @@ export default {
path += '.md'
}

if (repo && editLinks) {
const base = outboundRE.test(repo)
? repo
: `https://github.com/${repo}`
if (docsRepo && editLinks) {
const base = outboundRE.test(docsRepo)
? docsRepo
: `https://github.com/${docsRepo}`
return (
base.replace(endingSlashRE, '') +
`/edit/${docsBranch}/` +
Expand Down