From 0929941ca4f8a0dd1078f00159669e4b3fb31fe6 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Thu, 19 Oct 2023 09:49:09 +0800 Subject: [PATCH] feat: add 404 redirecting --- src/theme/NotFound.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/theme/NotFound.js diff --git a/src/theme/NotFound.js b/src/theme/NotFound.js new file mode 100644 index 00000000..bc626c0f --- /dev/null +++ b/src/theme/NotFound.js @@ -0,0 +1,13 @@ +import React from "react" +import NotFound from "@theme-original/NotFound" +import { useEffect } from "react" + +export default function NotFoundWrapper(props) { + useEffect(() => { + if (location.href.includes("/docs/")) { + location.href = location.href.replace("/docs/", "/") + } + }, []) + + return +}