提交 9e506724 编写于 作者: Y yanglbme

feat: add `Edit on GitHub` button for pages

添加“在 GitHub 编辑”按钮
上级 36e13c94
......@@ -186,7 +186,6 @@
GitHub 技术社区 [Doocs](https://github.com/doocs) 旗下唯一公众号「**Doocs开源社区**」​,欢迎扫码关注,**专注分享技术领域相关知识及行业最新资讯**。当然,也可以加我个人微信(备注:GitHub),拉你进技术交流群。
<table>
<tr>
<td align="center" style="width: 200px;">
<a href="https://github.com/doocs">
......@@ -201,5 +200,4 @@ GitHub 技术社区 [Doocs](https://github.com/doocs) 旗下唯一公众号「**
</a><br>
</td>
</tr>
</table>
......@@ -72,15 +72,28 @@
}
},
plugins: [
function (hook) {
var footer = [
'<hr/>',
'<footer>',
'<span>Copyright © 2018-2020 <a href="https://github.com/doocs" target="_blank">Doocs</a>. All rights reserved.',
'</footer>'
].join('')
function (hook, vm) {
hook.beforeEach(function (html) {
const en = vm.route.file.indexOf('README_EN') > -1
if (/githubusercontent\.com/.test(vm.route.file)) {
url = vm.route.file
.replace('raw.githubusercontent.com', 'github.com')
.replace(/\/master/, '/blob/master')
} else {
url = 'https://github.com/doocs/advanced-java/blob/master/' + vm.route.file
}
const edit = en ? 'Edit on GitHub' : '在 GitHub 编辑'
const editHtml = `[:memo: ${edit}](${url})\n`
return editHtml + html
})
hook.afterEach(function (html) {
const footer = [
'<hr/>',
'<footer>',
'<span>Copyright © 2018-2020 <a href="https://github.com/doocs" target="_blank">Doocs</a>. All rights reserved.',
'</footer>'
].join('')
return html + footer
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册