Skip to content

Commit 9b71a14

Browse files
committed
chore: remove useless
1 parent 3abf8b5 commit 9b71a14

File tree

3 files changed

+13
-57
lines changed

3 files changed

+13
-57
lines changed

docusaurus.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ const config: Config = {
201201
},
202202
},
203203
],
204+
[
205+
'@docusaurus/plugin-client-redirects',
206+
{
207+
redirects: [
208+
{
209+
from: '/',
210+
to: '/guides/'
211+
}
212+
]
213+
}
214+
215+
]
204216
],
205217
themes: ['@docusaurus/theme-mermaid'],
206218
markdown: {

src/theme/NotFound/404.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
import React from "react";
22
import { translate } from "@docusaurus/Translate";
33
import Layout from "@theme/Layout";
4-
import { useMount } from "ahooks";
5-
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
64
import Content from "./Content";
75

86
export default function NotFound404() {
9-
const pathname = ExecutionEnvironment.canUseDOM ? window?.location?.href : "";
10-
const redirectsMap = {
11-
"/doc/sql-reference": "/sql/sql-reference",
12-
"/doc/sql-commands": "/sql/sql-commands",
13-
"/doc/sql-functions": "/sql/sql-functions",
14-
"/doc/develop": "/developer/drivers",
15-
"/doc/deploy": "/guides/deploy",
16-
"/doc/cloud": "/guides/cloud",
17-
"/cloud/develop": "/developer/drivers",
18-
"/doc/sql-clients": "/guides/sql-clients",
19-
"/doc/load-data": "/guides/load-data",
20-
"/doc/visualize": "/guides/visualize",
21-
"/doc/monitor": "/guides/monitor",
22-
"/doc/overview": "/guides/overview",
23-
"/cloud/getting-started/new-account": "/guides/cloud/new-account",
24-
};
25-
useMount(() => {
26-
for (const [oldPath, newPath] of Object.entries(redirectsMap)) {
27-
if (pathname?.includes(oldPath)) {
28-
window.open(pathname.replace(oldPath, newPath), "_self");
29-
}
30-
}
31-
});
327
return (
338
<Layout
349
title={translate({

src/theme/NotFound/Content/index.tsx

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React from "react";
2-
import { useMount } from "ahooks";
32
import NotFoundSvg from "./no-found.svg";
43
import clsx from "clsx";
54
import $t from "@site/src/utils/tools";
65
import styles from "./not-found.module.scss";
7-
import { Button, Spin, Space } from "antd";
8-
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
6+
import { Button, Space } from "antd";
97
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
108

119
export default function Content() {
@@ -14,29 +12,6 @@ export default function Content() {
1412
customFields: { homeLink },
1513
},
1614
} = useDocusaurusContext();
17-
const pathname = ExecutionEnvironment.canUseDOM ? window?.location?.href : "";
18-
const redirectsMap = {
19-
"/doc/sql-reference": "/sql/sql-reference",
20-
"/doc/sql-commands": "/sql/sql-commands",
21-
"/doc/sql-functions": "/sql/sql-functions",
22-
"/doc/develop": "/developer/drivers",
23-
"/doc/deploy": "/guides/deploy",
24-
"/doc/cloud": "/guides/cloud",
25-
"/cloud/develop": "/developer/drivers",
26-
"/doc/sql-clients": "/guides/sql-clients",
27-
"/doc/load-data": "/guides/load-data",
28-
"/doc/visualize": "/guides/visualize",
29-
"/doc/monitor": "/guides/monitor",
30-
"/doc/overview": "/guides/overview",
31-
"/cloud/getting-started/new-account": "/guides/cloud/new-account",
32-
};
33-
useMount(() => {
34-
for (const [oldPath, newPath] of Object.entries(redirectsMap)) {
35-
if (pathname?.includes(oldPath)) {
36-
window.open(pathname.replace(oldPath, newPath), "_self");
37-
}
38-
}
39-
});
4015
return (
4116
<div
4217
className={clsx("g-align-c global-container-width", styles.rowContainer)}
@@ -46,12 +21,6 @@ export default function Content() {
4621
<div className={styles.notFoundTitle}>{$t("PAGE NOT FOUND")}</div>
4722
<div className="fontSize20">
4823
{$t("Please check your link or head Home to regroup.")}
49-
{Object.keys(redirectsMap).find((key) => pathname.includes(key)) && (
50-
<span>
51-
{" "}
52-
{$t("Redirecting to a new link")} <Spin></Spin>
53-
</span>
54-
)}
5524
</div>
5625
<Space size={16}>
5726
<Button type="primary" href="/guides">

0 commit comments

Comments
 (0)