return notFound instead of sending to overview page

This commit is contained in:
Madison 2025-07-30 12:52:59 -05:00
parent 230849744d
commit 50c4b592a4
5 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import { source } from 'lib/source';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
export function GET(request: NextRequest) {
@ -25,7 +25,7 @@ export function GET(request: NextRequest) {
// Page exists, redirect to the full path
return redirect(targetPath);
} else {
// Page doesn't exist, redirect to overview
return redirect('/docs/js/overview');
// Page doesn't exist, return 404
return notFound();
}
}

View File

@ -1,5 +1,5 @@
import { source } from 'lib/source';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
export function GET(request: NextRequest) {
@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
return redirect(targetPath);
} else {
// Page doesn't exist, redirect to overview
return redirect('/docs/next/overview');
return notFound();
}
}

View File

@ -1,5 +1,5 @@
import { source } from 'lib/source';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
export function GET(request: NextRequest) {
@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
return redirect(targetPath);
} else {
// Page doesn't exist, redirect to overview
return redirect('/docs/python/overview');
return notFound();
}
}

View File

@ -1,5 +1,5 @@
import { source } from 'lib/source';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
export function GET(request: NextRequest) {
@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
return redirect(targetPath);
} else {
// Page doesn't exist, redirect to overview
return redirect('/docs/react/overview');
return notFound();
}
}

View File

@ -1,5 +1,5 @@
import { apiSource } from 'lib/source';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
export function GET(request: NextRequest) {
@ -26,6 +26,6 @@ export function GET(request: NextRequest) {
return redirect(targetPath);
} else {
// Page doesn't exist, redirect to overview
return redirect('/api/overview');
return notFound();
}
}