We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 849a262 commit 2bd11f0Copy full SHA for 2bd11f0
1 file changed
app/docs/[[...slug]]/page.tsx
@@ -0,0 +1,16 @@
1
+import { redirect } from 'next/navigation';
2
+import { source } from '@/lib/source';
3
+
4
+export default async function DocsRedirectPage(props: {
5
+ params: Promise<{ slug?: string[] }>;
6
+}) {
7
+ const { slug } = await props.params;
8
+ const path = slug?.length ? `/cn/docs/${slug.join('/')}` : '/cn/docs';
9
+ redirect(path);
10
+}
11
12
+export async function generateStaticParams() {
13
+ return source.generateParams()
14
+ .filter((p) => p.lang === 'cn')
15
+ .map(({ slug }) => ({ slug }));
16
0 commit comments