diff --git a/docusaurus.config.js b/docusaurus.config.js index 89bfbad..300a358 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -120,7 +120,7 @@ const config = { }, { label: 'Installation', - href: 'https://docs.ivorysql.org/en/ivorysql-doc/v5.1/v5.1/3.1#quick-installation', + to: '/docs-installation', }, { label: 'Contribution Guidelines', @@ -146,7 +146,7 @@ const config = { }, { label: 'Ecological Cooperation', - href: 'https://docs.ivorysql.org/en/ivorysql-doc/v5.1/v5.1/5.0', + to: '/docs-ecosystem', position: 'left' }, { @@ -181,6 +181,10 @@ const config = { href: 'https://github.com/IvorySQL/IvorySQL', label: 'Github', }, + { + href: 'https://atomgit.com/IvorySQL/IvorySQL', + label: 'GitCode', + }, ] }, { @@ -262,4 +266,4 @@ const config = { }), }; -module.exports = config; \ No newline at end of file +module.exports = config; diff --git a/src/pages/docs-ecosystem.js b/src/pages/docs-ecosystem.js new file mode 100644 index 0000000..a910477 --- /dev/null +++ b/src/pages/docs-ecosystem.js @@ -0,0 +1,35 @@ +import React, { useEffect } from 'react'; +import Layout from '@theme/Layout'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; + +const DOCS_BASE = 'https://docs.ivorysql.org'; +const DOCS_VERSION = 'v5.1/v5.1'; + +function buildTarget(locale) { + const normalizedLocale = (locale || 'en').toLowerCase(); + const docsLocaleSegment = normalizedLocale.startsWith('zh') ? 'cn' : 'en'; + return `${DOCS_BASE}/${docsLocaleSegment}/ivorysql-doc/${DOCS_VERSION}/5.0`; +} + +export default function DocsEcosystemRedirect() { + const { i18n } = useDocusaurusContext(); + const target = buildTarget(i18n.currentLocale); + + useEffect(() => { + if (typeof window === 'undefined') { + return; + } + window.location.replace(target); + }, [target]); + + return ( + +
+

Redirecting to documentation...

+

+ If you are not redirected, click here. +

+
+
+ ); +} diff --git a/src/pages/docs-installation.js b/src/pages/docs-installation.js new file mode 100644 index 0000000..0cec2d1 --- /dev/null +++ b/src/pages/docs-installation.js @@ -0,0 +1,35 @@ +import React, { useEffect } from 'react'; +import Layout from '@theme/Layout'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; + +const DOCS_BASE = 'https://docs.ivorysql.org'; +const DOCS_VERSION = 'v5.1/v5.1'; + +function buildTarget(locale) { + const normalizedLocale = (locale || 'en').toLowerCase(); + const docsLocaleSegment = normalizedLocale.startsWith('zh') ? 'cn' : 'en'; + return `${DOCS_BASE}/${docsLocaleSegment}/ivorysql-doc/${DOCS_VERSION}/3.1#quick-installation`; +} + +export default function DocsInstallationRedirect() { + const { i18n } = useDocusaurusContext(); + const target = buildTarget(i18n.currentLocale); + + useEffect(() => { + if (typeof window === 'undefined') { + return; + } + window.location.replace(target); + }, [target]); + + return ( + +
+

Redirecting to documentation...

+

+ If you are not redirected, click here. +

+
+
+ ); +}