File tree Expand file tree Collapse file tree 9 files changed +19
-23
lines changed
Expand file tree Collapse file tree 9 files changed +19
-23
lines changed Original file line number Diff line number Diff line change 11import { EnhancedAPIPage } from '@/components/api/enhanced-api-page' ;
22import { getMDXComponents } from '@/mdx-components' ;
33import { apiSource } from 'lib/source' ;
4- import { notFound } from 'next/navigation' ;
4+ import { redirect } from 'next/navigation' ;
55import { SharedContentLayout } from '../../../components/layouts/shared-content-layout' ;
66
77export default async function ApiPage ( {
@@ -12,7 +12,7 @@ export default async function ApiPage({
1212 const { slug } = await params ;
1313 const page = apiSource . getPage ( slug ?? [ ] ) ;
1414
15- if ( ! page ) notFound ( ) ;
15+ if ( ! page ) redirect ( "/" ) ;
1616
1717 const MDX = page . data . body ;
1818
Original file line number Diff line number Diff line change 77import { getMDXComponents } from '@/mdx-components' ;
88import { createRelativeLink } from 'fumadocs-ui/mdx' ;
99import { source } from 'lib/source' ;
10- import { notFound , redirect } from 'next/navigation' ;
10+ import { redirect } from 'next/navigation' ;
1111
1212export default async function Page ( props : {
1313 params : Promise < { slug ?: string [ ] } > ,
@@ -20,7 +20,7 @@ export default async function Page(props: {
2020 }
2121
2222 const page = source . getPage ( params . slug ) ;
23- if ( ! page ) notFound ( ) ;
23+ if ( ! page ) redirect ( "/" ) ;
2424
2525 const MDXContent = page . data . body ;
2626
@@ -52,7 +52,7 @@ export async function generateMetadata(props: {
5252} ) {
5353 const params = await props . params ;
5454 const page = source . getPage ( params . slug ) ;
55- if ( ! page ) notFound ( ) ;
55+ if ( ! page ) redirect ( "/" ) ;
5656
5757 return {
5858 title : page . data . title ,
Original file line number Diff line number Diff line change 11import { source } from 'lib/source' ;
2- import { notFound , redirect } from 'next/navigation' ;
2+ import { redirect } from 'next/navigation' ;
33import { NextRequest } from 'next/server' ;
44
55export function GET ( request : NextRequest ) {
@@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
2626 return redirect ( targetPath ) ;
2727 } else {
2828 // Page doesn't exist, return 404
29- return notFound ( ) ;
29+ return redirect ( "/" ) ;
3030 }
3131}
Original file line number Diff line number Diff line change 1- import { notFound } from 'next/navigation' ;
2- import { type NextRequest , NextResponse } from 'next/server' ;
1+ import { NextResponse , type NextRequest } from 'next/server' ;
32import { getLLMText } from '../../../../lib/get-llm-text' ;
43import { apiSource , source } from '../../../../lib/source' ;
54
@@ -19,7 +18,7 @@ export async function GET(
1918 page = apiSource . getPage ( slug ) ;
2019 }
2120
22- if ( ! page ) notFound ( ) ;
21+ if ( ! page ) redirect ( "/" ) ;
2322
2423 try {
2524 return new NextResponse ( await getLLMText ( page ) ) ;
Original file line number Diff line number Diff line change 11import { source } from 'lib/source' ;
2- import { notFound , redirect } from 'next/navigation' ;
2+ import { redirect } from 'next/navigation' ;
33import { NextRequest } from 'next/server' ;
44
55export function GET ( request : NextRequest ) {
@@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
2626 return redirect ( targetPath ) ;
2727 } else {
2828 // Page doesn't exist, redirect to overview
29- return notFound ( ) ;
29+ return redirect ( "/" ) ;
3030 }
3131}
Original file line number Diff line number Diff line change 1+ import { redirect } from "next/navigation" ;
12
23export default function NotFound ( ) {
3- return (
4- < div >
5- < h2 > 404 Not Found</ h2 >
6- </ div >
7- ) ;
4+ redirect ( "/" ) ;
85}
Original file line number Diff line number Diff line change 11import { source } from 'lib/source' ;
2- import { notFound , redirect } from 'next/navigation' ;
2+ import { redirect } from 'next/navigation' ;
33import { NextRequest } from 'next/server' ;
44
55export function GET ( request : NextRequest ) {
@@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
2626 return redirect ( targetPath ) ;
2727 } else {
2828 // Page doesn't exist, redirect to overview
29- return notFound ( ) ;
29+ return redirect ( "/" ) ;
3030 }
3131}
Original file line number Diff line number Diff line change 11import { source } from 'lib/source' ;
2- import { notFound , redirect } from 'next/navigation' ;
2+ import { redirect } from 'next/navigation' ;
33import { NextRequest } from 'next/server' ;
44
55export function GET ( request : NextRequest ) {
@@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
2626 return redirect ( targetPath ) ;
2727 } else {
2828 // Page doesn't exist, redirect to overview
29- return notFound ( ) ;
29+ return redirect ( "/" ) ;
3030 }
3131}
Original file line number Diff line number Diff line change 11import { apiSource } from 'lib/source' ;
2- import { notFound , redirect } from 'next/navigation' ;
2+ import { redirect } from 'next/navigation' ;
33import { NextRequest } from 'next/server' ;
44
55export function GET ( request : NextRequest ) {
@@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
2626 return redirect ( targetPath ) ;
2727 } else {
2828 // Page doesn't exist, redirect to overview
29- return notFound ( ) ;
29+ return redirect ( "/" ) ;
3030 }
3131}
You can’t perform that action at this time.
0 commit comments