From 34ccc58abde542fa13fd8d5733386296848dd46d Mon Sep 17 00:00:00 2001
From: Jason Yu <me@ycmjason.com>
Date: Fri, 20 Apr 2018 09:22:17 +0100
Subject: [PATCH 1/6] fixing #167

---
 .gitignore                     |  1 +
 lib/default-theme/NavLinks.vue | 22 ++++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 96930bdd73..f6246be661 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ node_modules
 .temp
 vuepress
 TODOs.md
+*.sw*
diff --git a/lib/default-theme/NavLinks.vue b/lib/default-theme/NavLinks.vue
index bbc8e601ff..0989669634 100644
--- a/lib/default-theme/NavLinks.vue
+++ b/lib/default-theme/NavLinks.vue
@@ -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"
@@ -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>
@@ -69,14 +69,20 @@ export default {
         })
       }))
     },
-    githubLink () {
+    repoLink () {
       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 => {
+        return repoHost.toLowerCase().includes(platform.toLowerCase())
+      });
+    },
   },
   methods: {
     isActive

From bb33ae3e631e8d5f44d95de2ed8c2cd0994e3b30 Mon Sep 17 00:00:00 2001
From: Jason Yu <me@ycmjason.com>
Date: Fri, 20 Apr 2018 10:22:40 +0100
Subject: [PATCH 2/6] added option to customise repoLabel

---
 docs/default-theme-config/README.md | 5 ++++-
 lib/default-theme/NavLinks.vue      | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/docs/default-theme-config/README.md b/docs/default-theme-config/README.md
index 6e7056e2c2..68ae6995a1 100644
--- a/docs/default-theme-config/README.md
+++ b/docs/default-theme-config/README.md
@@ -216,7 +216,7 @@ next: false
 ---
 ```
 
-## GitHub Repo and Edit Links
+## Git Repo and Edit Links
 
 Providing `themeConfig.repo` auto generates a GitHub link in the navbar and "Edit this page" links at the bottom of each page.
 
@@ -226,6 +226,9 @@ module.exports = {
   themeConfig: {
     // Assumes GitHub. Can also be a full GitLab url.
     repo: 'vuejs/vuepress',
+    // Customising the header label
+    // Defaults to "GitHub"/"GitLab"/"Bitbucket" depending on `themeConfig.repo`
+    repoLabel: 'Contribute!',
     // if your docs are not at the root of the repo
     docsDir: 'docs',
     // optional, defaults to master
diff --git a/lib/default-theme/NavLinks.vue b/lib/default-theme/NavLinks.vue
index 0989669634..216a076164 100644
--- a/lib/default-theme/NavLinks.vue
+++ b/lib/default-theme/NavLinks.vue
@@ -78,6 +78,8 @@ export default {
       }
     },
     repoLabel () {
+      if (this.$site.themeConfig.repoLabel) return this.$site.themeConfig.repoLabel
+
       const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github'
       return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => {
         return repoHost.toLowerCase().includes(platform.toLowerCase())

From a72e8a4432817ea5baecbddc7937441d1df0f119 Mon Sep 17 00:00:00 2001
From: Jason Yu <me@ycmjason.com>
Date: Fri, 20 Apr 2018 11:02:49 +0100
Subject: [PATCH 3/6] fixing styles

---
 lib/default-theme/NavLinks.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/default-theme/NavLinks.vue b/lib/default-theme/NavLinks.vue
index 216a076164..830ad5de38 100644
--- a/lib/default-theme/NavLinks.vue
+++ b/lib/default-theme/NavLinks.vue
@@ -108,12 +108,12 @@ export default {
     display inline-block
     margin-left 1.5rem
     line-height 2rem
-  .github-link
+  .repo-link
     margin-left 1.5rem
 
 @media (max-width: $MQMobile)
   .nav-links
-    .nav-item, .github-link
+    .nav-item, .repo-link
       margin-left 0
 
 @media (min-width: $MQMobile)

From 0e187306448b0969898c3197de222f7b6de76b5b Mon Sep 17 00:00:00 2001
From: Jason Yu <me@ycmjason.com>
Date: Fri, 20 Apr 2018 17:41:32 +0100
Subject: [PATCH 4/6] fixing non polifilled logic and unsafe match

---
 lib/default-theme/NavLinks.vue | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/default-theme/NavLinks.vue b/lib/default-theme/NavLinks.vue
index 830ad5de38..9ebdf15589 100644
--- a/lib/default-theme/NavLinks.vue
+++ b/lib/default-theme/NavLinks.vue
@@ -78,12 +78,19 @@ export default {
       }
     },
     repoLabel () {
+      if (!this.repoLink) return;
       if (this.$site.themeConfig.repoLabel) return this.$site.themeConfig.repoLabel
 
-      const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github'
-      return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => {
-        return repoHost.toLowerCase().includes(platform.toLowerCase())
-      });
+      const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0]
+      const platforms = ['GitHub', 'GitLab', 'Bitbucket']
+      for (let i = 0; i < platforms.length; i++) {
+        const platform = platforms[i]
+        if (new RegExp(platform, 'i').test(repoHost)) {
+          return platform
+        }
+      }
+
+      return 'Source'
     },
   },
   methods: {

From 1a103a4c6fbc37eb4355ac9776cc276746550687 Mon Sep 17 00:00:00 2001
From: Evan You <yyx990803@gmail.com>
Date: Fri, 20 Apr 2018 17:10:14 -0400
Subject: [PATCH 5/6] Update .gitignore

---
 .gitignore | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index f6246be661..96930bdd73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,3 @@ node_modules
 .temp
 vuepress
 TODOs.md
-*.sw*

From 7fac79e0c97f916c6a63a5ce5594d378a8218aab Mon Sep 17 00:00:00 2001
From: Evan You <yyx990803@gmail.com>
Date: Fri, 20 Apr 2018 17:14:04 -0400
Subject: [PATCH 6/6] Update NavLinks.vue

---
 lib/default-theme/NavLinks.vue | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/default-theme/NavLinks.vue b/lib/default-theme/NavLinks.vue
index 9ebdf15589..82230a683b 100644
--- a/lib/default-theme/NavLinks.vue
+++ b/lib/default-theme/NavLinks.vue
@@ -78,8 +78,10 @@ export default {
       }
     },
     repoLabel () {
-      if (!this.repoLink) return;
-      if (this.$site.themeConfig.repoLabel) return this.$site.themeConfig.repoLabel
+      if (!this.repoLink) return
+      if (this.$site.themeConfig.repoLabel) {
+        return this.$site.themeConfig.repoLabel
+      }
 
       const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0]
       const platforms = ['GitHub', 'GitLab', 'Bitbucket']