diff --git a/docs/src/pages/index.jsx b/docs/src/pages/index.jsx index be03cd9..d03a3d4 100644 --- a/docs/src/pages/index.jsx +++ b/docs/src/pages/index.jsx @@ -1,8 +1,15 @@ -import { Redirect } from "react-router-dom"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +// Full-page redirect, not a router : Docusaurus router targets are +// resolved without the site baseUrl, so a router-level redirect lands outside +// the /Qoderian/ prefix on GitHub Pages. In non-default locales, siteConfig +// .baseUrl already carries the locale prefix (e.g. /Qoderian/zh-Hans/), so no +// manual locale handling is needed. export default function Home() { - const { i18n } = useDocusaurusContext(); - const prefix = i18n.currentLocale === i18n.defaultLocale ? "" : `/${i18n.currentLocale}`; - return ; + const { siteConfig } = useDocusaurusContext(); + if (typeof window !== "undefined") { + const base = siteConfig.baseUrl.replace(/\/$/, ""); + window.location.replace(`${base}/docs/introduction`); + } + return null; }