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

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


The following commit(s) were added to refs/heads/master by this push:
     new 24c3beea2c [fix]fix broken links (#960)
24c3beea2c is described below

commit 24c3beea2c7bc13a6391819799a12674869fbf74
Author: 0xFlackoLFG <k9745u...@gmail.com>
AuthorDate: Wed Aug 7 14:47:55 2024 +0800

    [fix]fix broken links (#960)
---
 common_docs_zh/gettingStarted/demo-block/latest.tsx   | 15 +++++++++++++--
 .../gettingStarted/demo-block/page-hero-1.tsx         | 17 ++++++++++++++---
 .../gettingStarted/demo-block/page-hero-2.tsx         | 17 ++++++++++++++---
 .../gettingStarted/demo-block/page-hero.tsx           | 17 ++++++++++++++---
 gettingStarted/demo-block/latest.tsx                  | 15 +++++++++++++--
 gettingStarted/demo-block/page-hero-1.tsx             | 17 ++++++++++++++---
 gettingStarted/demo-block/page-hero-2.tsx             | 17 ++++++++++++++---
 gettingStarted/demo-block/page-hero.tsx               | 17 ++++++++++++++---
 src/theme/Navbar/Content/index.tsx                    | 19 ++++++++++++-------
 9 files changed, 122 insertions(+), 29 deletions(-)

diff --git a/common_docs_zh/gettingStarted/demo-block/latest.tsx 
b/common_docs_zh/gettingStarted/demo-block/latest.tsx
index e002c491ff..b5863d10b6 100644
--- a/common_docs_zh/gettingStarted/demo-block/latest.tsx
+++ b/common_docs_zh/gettingStarted/demo-block/latest.tsx
@@ -1,8 +1,19 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 
 
 export default function Latest() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -27,7 +38,7 @@ export default function Latest() {
                         <div style={{ fontSize: 12, marginBottom: 20 }}>联合众多 
Doris 
生态中的开发者、用户以及合作伙伴,共同发起和创建的问答社区。在这里,你可以自由的提出和讨论技术问题、分享和收获技术经验、与社区的小伙伴进行互动和交流。</div>
                         <div style={{ fontSize: 14, marginBottom: 10 
}}>进入论坛</div>
                     </a>
-                    <a className="latest-button" 
href="../releasenotes/v2.1/release-2.1.5">
+                    <a className="latest-button" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/releasenotes/v2.1/release-2.1.5`}>
                         <div 
className="home-page-hero-button-label"><div>版本发布</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
diff --git a/common_docs_zh/gettingStarted/demo-block/page-hero-1.tsx 
b/common_docs_zh/gettingStarted/demo-block/page-hero-1.tsx
index 30854f08d6..1b3c8405b9 100644
--- a/common_docs_zh/gettingStarted/demo-block/page-hero-1.tsx
+++ b/common_docs_zh/gettingStarted/demo-block/page-hero-1.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 export default function PageHero() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero() {
                     </div>
                 </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button-CN" 
href="../practical-guide/log-storage-analysis">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/practical-guide/log-storage-analysis`}>
                         <div 
className="home-page-hero-button-label"><div>实践教程</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 }}>如何基于 
Apache Doris 构建开放、高性能低成本、统一的日志存储分析平台。</div>
                     </a>
-                    <a className="latest-button-CN" 
href="../lakehouse/datalake-analytics/hive">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/lakehouse/datalake-analytics/hive`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>湖仓一体</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/common_docs_zh/gettingStarted/demo-block/page-hero-2.tsx 
b/common_docs_zh/gettingStarted/demo-block/page-hero-2.tsx
index 33be9d5128..9667829079 100644
--- a/common_docs_zh/gettingStarted/demo-block/page-hero-2.tsx
+++ b/common_docs_zh/gettingStarted/demo-block/page-hero-2.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 export default function PageHero2() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero2() {
                     </div>
                 </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button-CN" href="../query/nereids">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/query/nereids`}>
                         <div 
className="home-page-hero-button-label"><div>数据查询</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero2() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 
}}>现代架构的全新查询优化器,能够更高效处理当前 Doris 场景的查询请求,同时提供更好的扩展性。</div>
                     </a>
-                    <a className="latest-button-CN" 
href="../table-design/index/inverted-index">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/table-design/index/inverted-index`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>数据表设计</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/common_docs_zh/gettingStarted/demo-block/page-hero.tsx 
b/common_docs_zh/gettingStarted/demo-block/page-hero.tsx
index 69df31aa50..c5a7c9f23b 100644
--- a/common_docs_zh/gettingStarted/demo-block/page-hero.tsx
+++ b/common_docs_zh/gettingStarted/demo-block/page-hero.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 export default function PageHero1() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero1() {
                     </div>
                 </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button-CN" 
href="../get-starting/tutorials/doris-hudi">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/gettingStarted/tutorials/doris-hudi`}>
                         <div 
className="home-page-hero-button-label"><div>使用教程</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero1() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 }}>如何快速搭建 
Apache Doris 与 Hudi 测试及演示环境,并对各功能操作进行演示。</div>
                     </a>
-                    <a className="latest-button-CN" 
href="../get-starting/tutorials/doris-paimon">
+                    <a className="latest-button-CN" 
href={`/zh-CN/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/gettingStarted/tutorials/doris-paimon`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>使用教程</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/gettingStarted/demo-block/latest.tsx 
b/gettingStarted/demo-block/latest.tsx
index 14e255bb94..a1dc27b761 100644
--- a/gettingStarted/demo-block/latest.tsx
+++ b/gettingStarted/demo-block/latest.tsx
@@ -1,7 +1,18 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 
 export default function Latest() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -26,7 +37,7 @@ export default function Latest() {
                         <div style={{ fontSize: 12, marginBottom: 20 }}>A 
platform to fostering connects within the community for addressing technical 
inquiries and providing support.</div>
                         <div style={{ fontSize: 14, marginBottom: 10 }}>Learn 
more</div>
                     </a>
-                    <a className="latest-button" 
href="../releasenotes/v2.1/release-2.1.5">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/releasenotes/v2.1/release-2.1.5`}>
                         <div 
className="home-page-hero-button-label"><div>Release</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
diff --git a/gettingStarted/demo-block/page-hero-1.tsx 
b/gettingStarted/demo-block/page-hero-1.tsx
index 1ed97f43d3..419fd9637f 100644
--- a/gettingStarted/demo-block/page-hero-1.tsx
+++ b/gettingStarted/demo-block/page-hero-1.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 export default function PageHero1() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero1() {
                     </div>
                 </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button" 
href="../practical-guide/log-storage-analysis">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/practical-guide/log-storage-analysis`}>
                         <div className="home-page-hero-button-label"><div>Use 
Case</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero1() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 }}>To 
build an open, high-performance, cost-effective and unified log storage and 
analysis platform.</div>
                     </a>
-                    <a className="latest-button" 
href="../lakehouse/datalake-analytics/hive">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/lakehouse/datalake-analytics/hive`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>Lakehouse</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/gettingStarted/demo-block/page-hero-2.tsx 
b/gettingStarted/demo-block/page-hero-2.tsx
index 72cedeceaa..5fcd7ca994 100644
--- a/gettingStarted/demo-block/page-hero-2.tsx
+++ b/gettingStarted/demo-block/page-hero-2.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
 import './demo-block.css';
 export default function PageHero1() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero1() {
                     </div>
                 </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button" href="../query/nereids">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/query/nereids`}>
                         <div className="home-page-hero-button-label"><div>Data 
Query</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero1() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 }}>To 
build an open, high-performance, cost-effective and unified log storage and 
analysis platform.</div>
                     </a>
-                    <a className="latest-button" 
href="../table-design/index/inverted-index">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/table-design/index/inverted-index`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>Data Table Design</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/gettingStarted/demo-block/page-hero.tsx 
b/gettingStarted/demo-block/page-hero.tsx
index 5de5b770d2..df8d26ccb1 100644
--- a/gettingStarted/demo-block/page-hero.tsx
+++ b/gettingStarted/demo-block/page-hero.tsx
@@ -1,6 +1,17 @@
-import React from 'react';
+import React,{useState,useEffect} from 'react';
 import './demo-block.css';
 export default function PageHero() {
+    const [currentVersion, setCurrentVersion] = useState('')
+    useEffect(() => {
+        if (typeof window !== 'undefined') {
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+        }
+    }, [typeof window !== 'undefined' && location.pathname]);
     return (
         <>
             <div className="home-page-hero">
@@ -11,7 +22,7 @@ export default function PageHero() {
             </div>
         </div> */}
                 <div className="home-page-hero-right">
-                    <a className="latest-button" 
href="../get-starting/tutorials/doris-hudi">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/gettingStarted/tutorials/doris-hudi`}>
                         <div 
className="home-page-hero-button-label"><div>Tutorials</div></div>
                         <div className="latest-button-title">
                             {/* <div className="home-page-hero-button-icon">
@@ -24,7 +35,7 @@ export default function PageHero() {
                         </div>
                         <div style={{ fontSize: 12, marginBottom: 20 }}>How to 
quickly set up a test & demo environment for Apache Doris and Hudi and how to 
use.</div>
                     </a>
-                    <a className="latest-button" 
href="../get-starting/tutorials/doris-paimon">
+                    <a className="latest-button" href={`/docs${currentVersion 
=== '' ? '' : `/${currentVersion}`}/gettingStarted/tutorials/doris-paimon`}>
                         <div className="latest-button-title">
                             <div 
className="home-page-hero-button-label"><div>Tutorials</div></div>
                             {/* <div className="home-page-hero-button-icon">
diff --git a/src/theme/Navbar/Content/index.tsx 
b/src/theme/Navbar/Content/index.tsx
index 94426acf34..c9d7cd0ff9 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -52,22 +52,27 @@ export default function NavbarContent({ mobile }) {
     const searchBarItem = items.find(item => item.type === 'search');
     const [star, setStar] = useState<any>();
     const [isDocsPage, setIsDocsPage] = useState(false);
-    const [startWithDoc, setStartWithDoc] = useState(true);
     const [isCommunity, setIsCommunity] = useState(false);
     const [isEN, setIsEN] = useState(true);
+    const [currentVersion, setCurrentVersion] = useState('')
     useEffect(() => {
         getGithubStar();
         if (typeof window !== 'undefined') {
-            const tempPath = ['get-starting', 'benchmark', 'ecosystems', 
'faq', 'docs', 'releasenotes'];
+            const tempPath = ['gettingStarted', 'benchmark', 'ecosystems', 
'faq', 'docs', 'releasenotes'];
+
+            const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
+            if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath)
+            } else {
+                setCurrentVersion('')
+            }
+
             const pathname = location.pathname.split('/')[1];
             location.pathname.includes('zh-CN') ? setIsEN(false) : 
setIsEN(true);
-            const docsStart = pathname === 'docs' || 
location.pathname.includes('zh-CN/docs');
-            const docsPage =
-                tempPath.includes(pathname) || tempPath.some(path => 
location.pathname.includes(`zh-CN/${path}`));
+            const docsPage = location.pathname.includes('docs')
             const communityPage = pathname === 'community' || 
location.pathname.includes('zh-CN/community');
             setIsCommunity(communityPage);
             setIsDocsPage(docsPage);
-            setStartWithDoc(docsStart);
         }
     }, [typeof window !== 'undefined' && location.pathname]);
 
@@ -102,7 +107,7 @@ export default function NavbarContent({ mobile }) {
                             <div
                                 className="cursor-pointer docs"
                                 onClick={() => {
-                                    window.location.href = `/docs${isEN ? '' : 
'/zh-CN'}/gettingStarted/what-is-new`;
+                                    window.location.href = `${isEN ? '' : 
'/zh-CN'}/docs${currentVersion === '' ? '' : 
`/${currentVersion}`}/gettingStarted/what-is-new`;
                                 }}
                             >
                                 {isEN ? <DocsLogoNew /> : <DocsLogoZH />}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to