You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/05/18 02:01:04 UTC

[incubator-inlong-website] branch master updated: [INLONG-4150][Office-Website] Automatically identify version number sorting (#378)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 557b87e4d [INLONG-4150][Office-Website] Automatically identify version number sorting (#378)
557b87e4d is described below

commit 557b87e4dcfe1cd65cd1c16ee5f44c8b28cf93ef
Author: Daniel <le...@outlook.com>
AuthorDate: Wed May 18 10:01:00 2022 +0800

    [INLONG-4150][Office-Website] Automatically identify version number sorting (#378)
---
 docusaurus.config.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index 55789d416..8d070ed55 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -269,6 +269,23 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
           return `https://github.com/apache/incubator-inlong-website/edit/master/${versionDocsDirPath}/${docPath}`;
         },
         sidebarPath: require.resolve('./sidebarsDevelopment.js'),
+        async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
+          const sidebarItems = await defaultSidebarItemsGenerator(args);
+          const gen = (item) => item.id
+            ?.match(/release-([\d|\.]+)/)?.[1]
+            ?.split('.')
+          return sidebarItems.sort((a, b) => {
+            let i = 0;
+            const arr1 = gen(a);
+            const arr2 = gen(b);
+            while (true) {
+              const s1 = arr1?.[i];
+              const s2 = arr2?.[i++];
+              if (s1 === s2) continue;
+              return s2 - s1 || 1;
+            }
+          });
+        },
       },
     ],
     [