diff --git a/packages/@vuepress/theme-default/components/PageEdit.vue b/packages/@vuepress/theme-default/components/PageEdit.vue index 3f1ef8b486..16dcec1116 100644 --- a/packages/@vuepress/theme-default/components/PageEdit.vue +++ b/packages/@vuepress/theme-default/components/PageEdit.vue @@ -92,12 +92,24 @@ export default { ) } + const gitlab = /gitlab.com/ + if (gitlab.test(repo)) { + const base = docsRepo + return ( + base.replace(endingSlashRE, '') + + `/-/edit` + + `/${docsBranch}/` + + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + + path + ) + } + const base = outboundRE.test(docsRepo) ? docsRepo : `https://github.com/${docsRepo}` return ( base.replace(endingSlashRE, '') - + (/gitlab.com/.test(repo) ? '/-/edit/' : '/edit') + + '/edit' + `/${docsBranch}/` + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + path