Skip to content

Commit ef3f124

Browse files
authored
Merge pull request #204 from faweizhao26/fix
fix two links and add the link of gitcode
2 parents df01fe7 + 8592751 commit ef3f124

3 files changed

Lines changed: 77 additions & 3 deletions

File tree

docusaurus.config.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const config = {
133133
},
134134
{
135135
label: 'Installation',
136-
href: 'https://docs.ivorysql.org/en/ivorysql-doc/v5.1/v5.1/3.1#quick-installation',
136+
to: '/docs-installation',
137137
},
138138
{
139139
label: 'Contribution Guidelines',
@@ -159,7 +159,7 @@ const config = {
159159
},
160160
{
161161
label: 'Ecological Cooperation',
162-
href: 'https://docs.ivorysql.org/en/ivorysql-doc/v5.1/v5.1/5.0',
162+
to: '/docs-ecosystem',
163163
position: 'left'
164164
},
165165
{
@@ -194,6 +194,10 @@ const config = {
194194
href: 'https://github.com/IvorySQL/IvorySQL',
195195
label: 'Github',
196196
},
197+
{
198+
href: 'https://atomgit.com/IvorySQL/IvorySQL',
199+
label: 'GitCode',
200+
},
197201
]
198202
},
199203
{
@@ -275,4 +279,4 @@ const config = {
275279
}),
276280
};
277281

278-
module.exports = config;
282+
module.exports = config;

src/pages/docs-ecosystem.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

src/pages/docs-installation.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)