Skip to content

Commit 34ccc58

Browse files
committed
fixing #167
1 parent c83b951 commit 34ccc58

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
.temp
55
vuepress
66
TODOs.md
7+
*.sw*

lib/default-theme/NavLinks.vue

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<nav class="nav-links" v-if="userLinks.length || githubLink">
2+
<nav class="nav-links" v-if="userLinks.length || repoLink">
33
<!-- user links -->
44
<div
55
class="nav-item"
@@ -8,13 +8,13 @@
88
<DropdownLink v-if="item.type === 'links'" :item="item"/>
99
<NavLink v-else :item="item"/>
1010
</div>
11-
<!-- github link -->
12-
<a v-if="githubLink"
13-
:href="githubLink"
14-
class="github-link"
11+
<!-- repo link -->
12+
<a v-if="repoLink"
13+
:href="repoLink"
14+
class="repo-link"
1515
target="_blank"
1616
rel="noopener noreferrer">
17-
GitHub
17+
{{ repoLabel }}
1818
<OutboundLink/>
1919
</a>
2020
</nav>
@@ -69,14 +69,20 @@ export default {
6969
})
7070
}))
7171
},
72-
githubLink () {
72+
repoLink () {
7373
const { repo } = this.$site.themeConfig
7474
if (repo) {
7575
return /^https?:/.test(repo)
7676
? repo
7777
: `https://github.com/${repo}`
7878
}
79-
}
79+
},
80+
repoLabel () {
81+
const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github'
82+
return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => {
83+
return repoHost.toLowerCase().includes(platform.toLowerCase())
84+
});
85+
},
8086
},
8187
methods: {
8288
isActive

0 commit comments

Comments
 (0)