Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
},
{
Expand Down Expand Up @@ -181,6 +181,10 @@ const config = {
href: 'https://github.com/IvorySQL/IvorySQL',
label: 'Github',
},
{
href: 'https://atomgit.com/IvorySQL/IvorySQL',
label: 'GitCode',
},
]
},
{
Expand Down Expand Up @@ -262,4 +266,4 @@ const config = {
}),
};

module.exports = config;
module.exports = config;
35 changes: 35 additions & 0 deletions src/pages/docs-ecosystem.js
Original file line number Diff line number Diff line change
@@ -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 (
<Layout title="Redirecting...">
<main style={{ padding: '2rem', textAlign: 'center' }}>
<p>Redirecting to documentation...</p>
<p>
If you are not redirected, <a href={target}>click here</a>.
</p>
</main>
</Layout>
);
}
35 changes: 35 additions & 0 deletions src/pages/docs-installation.js
Original file line number Diff line number Diff line change
@@ -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 (
<Layout title="Redirecting...">
<main style={{ padding: '2rem', textAlign: 'center' }}>
<p>Redirecting to documentation...</p>
<p>
If you are not redirected, <a href={target}>click here</a>.
</p>
</main>
</Layout>
);
}