You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ur...@apache.org on 2022/09/05 07:28:00 UTC

[pulsar-site] 01/01: quick versions swith

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

urfree pushed a commit to branch quick-versions-switch
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit bfbea4be25d9a437fadb205cb47442ab15f0a6d9
Author: Li Li <ur...@apache.org>
AuthorDate: Mon Sep 5 15:27:34 2022 +0800

    quick versions swith
    
    Signed-off-by: Li Li <ur...@apache.org>
---
 .../src/theme/DocsVersionDropdownNavbarItem.js     | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/site2/website-next/src/theme/DocsVersionDropdownNavbarItem.js b/site2/website-next/src/theme/DocsVersionDropdownNavbarItem.js
index 5c20c90ba3d..9eec119a8bd 100644
--- a/site2/website-next/src/theme/DocsVersionDropdownNavbarItem.js
+++ b/site2/website-next/src/theme/DocsVersionDropdownNavbarItem.js
@@ -14,17 +14,17 @@ import {
 } from "@docusaurus/plugin-content-docs/client";
 import { useDocsPreferredVersion } from "@docusaurus/theme-common";
 import { translate } from "@docusaurus/Translate";
-// let versions = require("../../versions.json");
-// const _latestVersion = versions[0];
-// versions = [{ name: "current", label: "Master", path: "/docs/next" }].concat(
-//   versions.map((item) => {
-//     return {
-//       label: item,
-//       name: item,
-//       path: item == _latestVersion ? "/docs" : "/docs/" + item,
-//     };
-//   })
-// );
+let versions = require("../../versions.json");
+const _latestVersion = versions[0];
+versions = [{ name: "current", label: "Next", path: "/docs/next" }].concat(
+  versions.map((item) => {
+    return {
+      label: item,
+      name: item,
+      path: item == _latestVersion ? "/docs" : "/docs/" + item,
+    };
+  }).slice(0, 5)
+);
 
 const getVersionMainDoc = (version) =>
   version.docs.find((doc) => doc.id === version.mainDocId);
@@ -42,14 +42,14 @@ export default function DocsVersionDropdownNavbarItem({
   const latestVersion = useLatestVersion(docsPluginId);
   const { preferredVersion, savePreferredVersionName } =
     useDocsPreferredVersion(docsPluginId);
-  const versions = [
-    activeDocContext.activeVersion,
-    {
-      name: "others",
-      label: "Other",
-      path: "/versions",
-    },
-  ];
+  // const versions = [
+  //   activeDocContext.activeVersion,
+  //   {
+  //     name: "others",
+  //     label: "Other",
+  //     path: "/versions",
+  //   },
+  // ];
   function getItems() {
     const versionLinks = versions.map((version) => {
       // We try to link to the same doc, in another version