File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const lightCodeTheme = require ( 'prism-react-renderer/themes/github' ) ;
22const darkCodeTheme = require ( 'prism-react-renderer/themes/dracula' ) ;
3- const currentLocale = process . env . DOCUSAURUS_CURRENT_LOCALE || 'en' ;
4- const docsLocaleSegment = currentLocale === 'zh-CN' ? 'cn' : 'en' ;
5- const docsBaseUrl = `https://docs.ivorysql.org/${ docsLocaleSegment } /ivorysql-doc/v5.1/v5.1` ;
63
74/** @type {import('@docusaurus/types').Config } */
85const config = {
@@ -123,7 +120,7 @@ const config = {
123120 } ,
124121 {
125122 label : 'Installation' ,
126- href : ` ${ docsBaseUrl } /3.1#quick -installation` ,
123+ to : '/docs -installation' ,
127124 } ,
128125 {
129126 label : 'Contribution Guidelines' ,
@@ -149,7 +146,7 @@ const config = {
149146 } ,
150147 {
151148 label : 'Ecological Cooperation' ,
152- href : ` ${ docsBaseUrl } /5.0` ,
149+ to : '/docs-ecosystem' ,
153150 position : 'left'
154151 } ,
155152 {
Original file line number Diff line number Diff line change 1+ import React , { useEffect } from 'react' ;
2+ import Layout from '@theme/Layout' ;
3+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
4+
5+ const DOCS_BASE = 'https://docs.ivorysql.org' ;
6+ const DOCS_VERSION = 'v5.1/v5.1' ;
7+
8+ function buildTarget ( locale ) {
9+ const normalizedLocale = ( locale || 'en' ) . toLowerCase ( ) ;
10+ const docsLocaleSegment = normalizedLocale . startsWith ( 'zh' ) ? 'cn' : 'en' ;
11+ return `${ DOCS_BASE } /${ docsLocaleSegment } /ivorysql-doc/${ DOCS_VERSION } /5.0` ;
12+ }
13+
14+ export default function DocsEcosystemRedirect ( ) {
15+ const { i18n } = useDocusaurusContext ( ) ;
16+ const target = buildTarget ( i18n . currentLocale ) ;
17+
18+ useEffect ( ( ) => {
19+ if ( typeof window === 'undefined' ) {
20+ return ;
21+ }
22+ window . location . replace ( target ) ;
23+ } , [ target ] ) ;
24+
25+ return (
26+ < Layout title = "Redirecting..." >
27+ < main style = { { padding : '2rem' , textAlign : 'center' } } >
28+ < p > Redirecting to documentation...</ p >
29+ < p >
30+ If you are not redirected, < a href = { target } > click here</ a > .
31+ </ p >
32+ </ main >
33+ </ Layout >
34+ ) ;
35+ }
Original file line number Diff line number Diff line change 1+ import React , { useEffect } from 'react' ;
2+ import Layout from '@theme/Layout' ;
3+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
4+
5+ const DOCS_BASE = 'https://docs.ivorysql.org' ;
6+ const DOCS_VERSION = 'v5.1/v5.1' ;
7+
8+ function buildTarget ( locale ) {
9+ const normalizedLocale = ( locale || 'en' ) . toLowerCase ( ) ;
10+ const docsLocaleSegment = normalizedLocale . startsWith ( 'zh' ) ? 'cn' : 'en' ;
11+ return `${ DOCS_BASE } /${ docsLocaleSegment } /ivorysql-doc/${ DOCS_VERSION } /3.1#quick-installation` ;
12+ }
13+
14+ export default function DocsInstallationRedirect ( ) {
15+ const { i18n } = useDocusaurusContext ( ) ;
16+ const target = buildTarget ( i18n . currentLocale ) ;
17+
18+ useEffect ( ( ) => {
19+ if ( typeof window === 'undefined' ) {
20+ return ;
21+ }
22+ window . location . replace ( target ) ;
23+ } , [ target ] ) ;
24+
25+ return (
26+ < Layout title = "Redirecting..." >
27+ < main style = { { padding : '2rem' , textAlign : 'center' } } >
28+ < p > Redirecting to documentation...</ p >
29+ < p >
30+ If you are not redirected, < a href = { target } > click here</ a > .
31+ </ p >
32+ </ main >
33+ </ Layout >
34+ ) ;
35+ }
You can’t perform that action at this time.
0 commit comments