mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
refactor(guide): always redirect to introduction
This commit is contained in:
1
apps/guide/src/app/guide/[...slug]/not-found.tsx
Normal file
1
apps/guide/src/app/guide/[...slug]/not-found.tsx
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from '~/app/not-found';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { allContents } from 'contentlayer/generated';
|
import { allContents } from 'contentlayer/generated';
|
||||||
import { redirect } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
import { Mdx } from '~/components/Mdx';
|
import { Mdx } from '~/components/Mdx';
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
@@ -10,7 +10,7 @@ export default function Page({ params }: { params: { slug: string[] } }) {
|
|||||||
const content = allContents.find((content) => content.slug === params.slug?.join('/'));
|
const content = allContents.find((content) => content.slug === params.slug?.join('/'));
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
redirect('/guide/home/introduction');
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
5
apps/guide/src/app/guide/page.tsx
Normal file
5
apps/guide/src/app/guide/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { redirect } from 'next/navigation';
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
redirect('/guide/home/introduction');
|
||||||
|
}
|
||||||
@@ -1,28 +1,3 @@
|
|||||||
import Image from 'next/image';
|
|
||||||
import vercelLogo from '~/assets/powered-by-vercel.svg';
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return (
|
return null;
|
||||||
<div className="mx-auto max-w-6xl min-h-screen flex flex-col place-items-center gap-12 px-8 py-16 lg:place-content-center lg:px-8 lg:py-0">
|
|
||||||
<div className="flex flex-row place-content-center">
|
|
||||||
<a
|
|
||||||
className="rounded outline-none focus:ring focus:ring-width-2 focus:ring-blurple"
|
|
||||||
href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"
|
|
||||||
rel="external noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Vercel"
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
alt="Vercel"
|
|
||||||
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
|
|
||||||
height={44}
|
|
||||||
placeholder="blur"
|
|
||||||
priority
|
|
||||||
src={vercelLogo}
|
|
||||||
width={212}
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
apps/guide/src/middleware.ts
Normal file
9
apps/guide/src/middleware.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { NextResponse, type NextRequest } from 'next/server';
|
||||||
|
|
||||||
|
export default async function middleware(request: NextRequest) {
|
||||||
|
return NextResponse.redirect(new URL('/guide/home/introduction', request.url));
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
matcher: ['/'],
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user