Skip to content

Commit

Permalink
fixing vuejs#167
Browse files Browse the repository at this point in the history
  • Loading branch information
ycmjason committed Apr 20, 2018
1 parent c83b951 commit 24ea10f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.temp
vuepress
TODOs.md
*.sw*
23 changes: 14 additions & 9 deletions lib/default-theme/NavLinks.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<nav class="nav-links" v-if="userLinks.length || githubLink">
<nav class="nav-links" v-if="userLinks.length || repoLink">
<!-- user links -->
<div
class="nav-item"
Expand All @@ -8,13 +8,13 @@
<DropdownLink v-if="item.type === 'links'" :item="item"/>
<NavLink v-else :item="item"/>
</div>
<!-- github link -->
<a v-if="githubLink"
:href="githubLink"
class="github-link"
<!-- repo link -->
<a v-if="repoLink"
:href="repoLink"
class="repo-link"
target="_blank"
rel="noopener noreferrer">
GitHub
{{ repoLabel }}
<OutboundLink/>
</a>
</nav>
Expand Down Expand Up @@ -69,14 +69,19 @@ export default {
})
}))
},
githubLink () {
const { repo } = this.$site.themeConfig
repoLink () {
const repo = 'https://gitlab.my-company.local/my-team/github/our-product'
// const { repo } = this.$site.themeConfig
if (repo) {
return /^https?:/.test(repo)
? repo
: `https://github.com/${repo}`
}
}
},
repoLabel () {
const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github';
return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => repoHost.toLowerCase().includes(platform.toLowerCase()));
},
},
methods: {
isActive
Expand Down

0 comments on commit 24ea10f

Please sign in to comment.