Skip to content

Commit 24ea10f

Browse files
committed
fixing #167
1 parent c83b951 commit 24ea10f

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
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-9
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,19 @@ export default {
6969
})
7070
}))
7171
},
72-
githubLink () {
73-
const { repo } = this.$site.themeConfig
72+
repoLink () {
73+
const repo = 'https://gitlab.my-company.local/my-team/github/our-product'
74+
// const { repo } = this.$site.themeConfig
7475
if (repo) {
7576
return /^https?:/.test(repo)
7677
? repo
7778
: `https://github.com/${repo}`
7879
}
79-
}
80+
},
81+
repoLabel () {
82+
const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github';
83+
return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => repoHost.toLowerCase().includes(platform.toLowerCase()));
84+
},
8085
},
8186
methods: {
8287
isActive

0 commit comments

Comments
 (0)