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

jeffreyh 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 56ca9c312d2 [doc]:set default version 3.0 (#2796)
56ca9c312d2 is described below

commit 56ca9c312d25fd7ba539bca7a9794bea1a9604b0
Author: yangon <[email protected]>
AuthorDate: Tue Aug 26 19:25:50 2025 +0800

    [doc]:set default version 3.0 (#2796)
---
 docusaurus.config.js                               | 28 ++++++++++++++++------
 src/constant/common.tsx                            |  2 --
 src/constant/version.ts                            |  2 ++
 src/pages/index.tsx                                |  5 ++--
 src/theme/Footer/index.tsx                         |  2 +-
 src/theme/Navbar/Content/components/NavbarDocs.tsx |  5 ++--
 src/theme/SearchBar/SearchBar.jsx                  |  4 ++--
 src/theme/TOC/index.tsx                            |  9 +++----
 8 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index 710609bff39..370505997ad 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -2,6 +2,8 @@ const themes = require('prism-react-renderer').themes;
 const versionsPlugin = require('./config/versions-plugin');
 const VERSIONS = require('./versions.json');
 const { markdownBoldPlugin } = require('./config/markdown-bold-plugin');
+const { DEFAULT_VERSION } = require('./src/constant/version');
+
 const lightCodeTheme = themes.dracula;
 
 const logoImg = '/images/logo.svg';
@@ -21,13 +23,17 @@ function getDocsVersions() {
                 banner: 'none',
                 badge: false,
             };
+            if (version === DEFAULT_VERSION) {
+                result[version].label = DEFAULT_VERSION;
+                result[version].path = DEFAULT_VERSION;
+            }
         }
     });
     return result;
 }
 
 function getLatestVersion() {
-    return VERSIONS.includes('2.1') ? '2.1' : VERSIONS[0];
+    return VERSIONS.includes(DEFAULT_VERSION) ? DEFAULT_VERSION : VERSIONS[0];
 }
 
 /** @type {import('@docusaurus/types').Config} */
@@ -107,18 +113,26 @@ const config = {
                     // /docs/oldDoc -> /docs/newDoc
                     {
                         from: '/docs/dev/summary/basic-summary',
-                        to: '/docs/gettingStarted/quick-start',
+                        to: 
`/docs/${DEFAULT_VERSION}/gettingStarted/quick-start`,
                     },
                     {
                         from: '/docs/dev/get-starting/',
-                        to: '/docs/gettingStarted/quick-start',
+                        to: 
`/docs/${DEFAULT_VERSION}/gettingStarted/quick-start`,
                     },
                 ],
                 createRedirects(existingPath) {
+                    if (existingPath.startsWith('/docs/3.0/')) {
+                        const withoutVersion = 
existingPath.replace('/docs/3.0/', '/docs/');
+                        return [withoutVersion];
+                    }
+                    // return [];
                     if 
(existingPath.includes('/gettingStarted/what-is-apache-doris')) {
                         // Redirect from /gettingStarted/what-is-new to 
/gettingStarted/what-is-apache-doris
                         return [
-                            
existingPath.replace('/gettingStarted/what-is-apache-doris', 
'/gettingStarted/what-is-new'),
+                            existingPath.replace(
+                                '/gettingStarted/what-is-apache-doris',
+                                '/gettingStarted/what-is-new',
+                            ),
                         ];
                     }
                     return undefined; // Return a falsy value: no redirect 
created
@@ -189,7 +203,7 @@ const config = {
                 highlightSearchTermsOnTargetPage: true,
                 // indexPages: true,
                 indexDocs: true,
-                // docsRouteBasePath: '/docs',
+                docsRouteBasePath: ['/docs/2.0', '/docs/2.1', '/docs/3.0', 
'/docs/dev'],
                 indexBlog: false,
                 explicitSearchResultPath: true,
                 searchBarShortcut: true,
@@ -237,7 +251,7 @@ const config = {
                     {
                         position: 'left',
                         label: 'Docs',
-                        to: '/docs/gettingStarted/what-is-apache-doris',
+                        to: 
`/docs/${DEFAULT_VERSION}/gettingStarted/what-is-apache-doris`,
                         target: '_blank',
                     },
                     { to: '/blog', label: 'Blog', position: 'left' },
@@ -360,7 +374,7 @@ const config = {
                     {
                         position: 'left',
                         label: 'Docs',
-                        to: '/docs/gettingStarted/what-is-apache-doris',
+                        to: 
`/docs/${DEFAULT_VERSION}/gettingStarted/what-is-apache-doris`,
                         target: '_blank',
                     },
                     { to: '/blog', label: 'Blog', position: 'left' },
diff --git a/src/constant/common.tsx b/src/constant/common.tsx
index 308aaf6963d..2c5673b37bc 100644
--- a/src/constant/common.tsx
+++ b/src/constant/common.tsx
@@ -19,6 +19,4 @@ export const BLOG_TAG_ICONS = {
     All: <AllBlogIcon />,
 };
 
-export const VERSIONS = ['1.2', '2.0', '2.1', '3.0', 'dev'];
-export const DEFAULT_VERSION = '2.1';
 export const ARCHIVE_PATH = 'archive-docs';
\ No newline at end of file
diff --git a/src/constant/version.ts b/src/constant/version.ts
new file mode 100644
index 00000000000..0a7383dd2fc
--- /dev/null
+++ b/src/constant/version.ts
@@ -0,0 +1,2 @@
+export const VERSIONS = ['1.2', '2.0', '2.1', '3.0', 'dev'];
+export const DEFAULT_VERSION = '3.0';
\ No newline at end of file
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index f821ab2039c..77f0a1a3eaf 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -16,6 +16,7 @@ import GetStarted from 
'@site/src/components/get-started/get-started';
 import HomeEvenStarIcon from '@site/static/images/home-event-star.svg';
 import { UserCaseCarousel } from '../components/user-case-carousel';
 import { NewsLetterSwiper } from '../components/newsletter-swiper';
+import { DEFAULT_VERSION } from '@site/src/constant/version';
 
 export default function Home(): JSX.Element {
     const { siteConfig } = useDocusaurusContext();
@@ -29,7 +30,7 @@ export default function Home(): JSX.Element {
         },
         {
             label: <Translate id="homepage.banner.button1">Get 
started</Translate>,
-            link: '/docs/gettingStarted/what-is-apache-doris',
+            link: 
`/docs/${DEFAULT_VERSION}/gettingStarted/what-is-apache-doris`,
             type: 'ghost',
         },
         {
@@ -430,7 +431,7 @@ export default function Home(): JSX.Element {
                     footer={
                         <div className="justify-center flex mt-14">
                             <LinkWithArrow
-                                to="/docs/gettingStarted/what-is-apache-doris"
+                                
to={`/docs/${DEFAULT_VERSION}/gettingStarted/what-is-apache-doris`}
                                 text={
                                     <Translate id="homepage.more" 
description="more link">
                                         Learn more
diff --git a/src/theme/Footer/index.tsx b/src/theme/Footer/index.tsx
index 0d9ed606547..060ecafcf2b 100644
--- a/src/theme/Footer/index.tsx
+++ b/src/theme/Footer/index.tsx
@@ -18,7 +18,7 @@ import { MediumIcon } from 
'@site/src/components/Icons/medium';
 import Translate from '@docusaurus/Translate';
 import Link from '@docusaurus/Link';
 
-function Footer(): JSX.Element | null {
+function Footer(): React.ReactElement | null {
     const { footer } = useThemeConfig();
     if (!footer) {
         return null;
diff --git a/src/theme/Navbar/Content/components/NavbarDocs.tsx 
b/src/theme/Navbar/Content/components/NavbarDocs.tsx
index 01f0edd3016..e9983a636ba 100644
--- a/src/theme/Navbar/Content/components/NavbarDocs.tsx
+++ b/src/theme/Navbar/Content/components/NavbarDocs.tsx
@@ -13,13 +13,14 @@ import SearchIcon from 
'@site/static/images/search-icon.svg';
 import CloseIcon from '@site/static/images/icon/close.svg';
 import { DataContext } from '../../../Layout';
 import { ARCHIVE_PATH } from '../../../../constant/common' ;
+import { DEFAULT_VERSION } from '../../../../constant/version' ;
 
 interface NavbarDocsProps {
     isEN: boolean;
 }
 
 export const NavbarDocsLeft = ({ isEN }: NavbarDocsProps) => {
-    const [currentVersion, setCurrentVersion] = useState('');
+    const [currentVersion, setCurrentVersion] = useState(DEFAULT_VERSION);
     const location = useLocation();
     const history = useHistory();
     const docItems = isEN ? useThemeConfig().docNavbarEN.items : 
useThemeConfig().docNavbarZH.items;
@@ -34,7 +35,7 @@ export const NavbarDocsLeft = ({ isEN }: NavbarDocsProps) => {
         if (location.pathname.includes('docs') && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
             setCurrentVersion(secPath);
         } else {
-            setCurrentVersion('');
+            setCurrentVersion(DEFAULT_VERSION);
         }
     }, [typeof window !== 'undefined' && location.pathname]);
     return (
diff --git a/src/theme/SearchBar/SearchBar.jsx 
b/src/theme/SearchBar/SearchBar.jsx
index a3cb62d71ed..3bebc916102 100644
--- a/src/theme/SearchBar/SearchBar.jsx
+++ b/src/theme/SearchBar/SearchBar.jsx
@@ -21,7 +21,7 @@ import {
     useAllContextsWithNoSearchContext,
 } from '../../utils/proxiedGenerated';
 import LoadingRing from '../LoadingRing/LoadingRing';
-import { VERSIONS, DEFAULT_VERSION } from '@site/src/constant/common';
+import { VERSIONS, DEFAULT_VERSION } from '@site/src/constant/version';
 import styles from './SearchBar.module.css';
 import { normalizeContextByPath } from '../../utils/normalizeContextByPath';
 import { searchResultLimits } from "../../utils/proxiedGeneratedConstants";
@@ -49,7 +49,7 @@ function getVersionUrl(baseUrl, pathname) {
     }
     if (pathname?.startsWith('/docs') || pathname?.startsWith('/zh-CN/docs')) {
         let version = pathname?.startsWith('/docs') ? pathname.split('/')[2] : 
pathname.split('/')[3];
-        if (VERSIONS.includes(version)) {
+        if (VERSIONS.includes(version) && version !== DEFAULT_VERSION) {
             versionUrl += `docs/${version}/`;
         }
     }
diff --git a/src/theme/TOC/index.tsx b/src/theme/TOC/index.tsx
index 911ba40313a..81fdaed1eeb 100644
--- a/src/theme/TOC/index.tsx
+++ b/src/theme/TOC/index.tsx
@@ -10,7 +10,7 @@ import { GithubIcon } from 
'../../components/Icons/github-icon';
 import { SlackIcon } from '../../components/Icons/slack-icon';
 import useIsBrowser from '@docusaurus/useIsBrowser';
 import { DOWNLOAD_PDFS } from '@site/src/constant/download.data';
-import { VERSIONS } from '@site/src/constant/common';
+import { VERSIONS, DEFAULT_VERSION } from '@site/src/constant/version';
 import Link from '@docusaurus/Link';
 
 import styles from './styles.module.css';
@@ -34,11 +34,10 @@ export function downloadFile(url: string, filename: string) 
{
     xml.send();
 }
 
-export default function TOC({ className, ...props }: Props): JSX.Element {
+export default function TOC({ className, ...props }: Props): 
React.ReactElement {
     const { siteConfig } = useDocusaurusContext();
     const isBrowser = useIsBrowser();
     const isCN = siteConfig.baseUrl.indexOf('zh-CN') > -1;
-    const DEFAULT_VERSION = '2.1';
     const [currentVersion, setCurrentVersion] = useState(DEFAULT_VERSION);
 
     useEffect(() => {
@@ -61,9 +60,7 @@ export default function TOC({ className, ...props }: Props): 
JSX.Element {
         <div className={clsx(styles.tableOfContents, 'thin-scrollbar', 
'toc-container', className)}>
             <div style={isBrowser && location.pathname.startsWith('/blog') ? { 
display: 'none' } : {}}>
                 <Link to={'/'}>
-                    <div
-                        className="toc-icon-content group"
-                    >
+                    <div className="toc-icon-content group">
                         <HomeIcon className="group-hover:text-[#444FD9]" />
                         <span className="group-hover:text-[#444FD9]">{isCN ? 
'Doris 首页' : 'Doris Homepage'}</span>
                     </div>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to