You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2021/07/29 11:17:18 UTC

[apisix-website] branch master updated: fix: showing Project's name on the navbar (#425)

This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a4254c  fix: showing Project's name on the navbar (#425)
4a4254c is described below

commit 4a4254c21c7fc825afc65e42e334496281ac2714
Author: Baoyuan <ba...@gmail.com>
AuthorDate: Thu Jul 29 19:17:12 2021 +0800

    fix: showing Project's name on the navbar (#425)
---
 website/src/theme/DocPage/index.js | 52 +++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/website/src/theme/DocPage/index.js b/website/src/theme/DocPage/index.js
index fcf3a6a..2491826 100644
--- a/website/src/theme/DocPage/index.js
+++ b/website/src/theme/DocPage/index.js
@@ -27,33 +27,33 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
     version,
   } = versionMetadata;
 
-  const pageId = {
-    general : "General",
-    apisix : "getting-started",
-    apisixDashboard : "dashboard",
-    apisixIngressController : "what-is-apisix-ingress-controller",
-    apisixHelmChart : "seeking-help",
-    apisixDocker : "build-an-image-from-source",
-    apisixJavaPluginRunner : "overview",
-    apisixGoRunner : "prerequisites"
-  }
   useEffect(() => {
-    if(docsSidebars[sidebarName][0].label === pageId.general){
-      document.querySelectorAll(".navbar__link--active")[0].text = "General";
-    } else if (document.getElementById(pageId.apisix)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX®";
-    } else if (document.getElementById(pageId.apisixDashboard)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Dashboard";
-    } else if (document.getElementById(pageId.apisixIngressController)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Ingress Controller";
-    } else if (document.getElementById(pageId.apisixHelmChart)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Helm Chart";
-    } else if (document.getElementById(pageId.apisixDocker)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Docker";
-    } else if (document.getElementById(pageId.apisixJavaPluginRunner)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Java Plugin Runner";
-    } else if (document.getElementById(pageId.apisixGoRunner)) {
-      document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Go Plugin Runner";
+    const currentPage = currentDocRoute.path.split("/")[2] || "";
+    switch (currentPage) {
+      case "general":
+        document.querySelectorAll(".navbar__link--active")[0].text = "General";
+        break;
+      case "apisix":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX®";
+        break;
+      case "dashboard":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Dashboard";
+        break;
+      case "ingress-controller":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Ingress Controller";
+        break;
+      case "helm-chart":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Helm Chart";
+        break;
+      case "docker":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Docker";
+        break;
+      case "java-plugin-runner":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Java Plugin Runner";
+        break;
+      case "go-plugin-runner":
+        document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX® Go Plugin Runner";
+        break;
     }
     return () => {
       console.log('\u{1F680} documentation changed')