mirror of
https://github.com/doocs/advanced-java.git
synced 2025-03-14 10:00:05 +08:00
feat: add Edit on GitHub
button for pages
添加“在 GitHub 编辑”按钮
This commit is contained in:
parent
36e13c9496
commit
9e50672429
@ -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>
|
||||
|
27
index.html
27
index.html
@ -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
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user