From 7a84c94c3b1f46649ca20752657adf1fe64a76f8 Mon Sep 17 00:00:00 2001 From: Local Administrator Date: Mon, 29 Jun 2026 05:38:52 +0000 Subject: [PATCH] Articles: force-dynamic + notFound for deleted posts (no stale ISR) --- src/app/articles/[slug]/page.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/articles/[slug]/page.tsx b/src/app/articles/[slug]/page.tsx index 0a9557b..db05d89 100644 --- a/src/app/articles/[slug]/page.tsx +++ b/src/app/articles/[slug]/page.tsx @@ -1,6 +1,6 @@ import type { Metadata } from "next"; import { cleanExcerpt } from "@/lib/articles/excerpt"; -import { redirect } from "next/navigation"; +import { notFound } from "next/navigation"; import ArticleDetailPage from "./ArticleDetailClient"; import type { Article } from "@/lib/articles/types"; import { @@ -10,7 +10,10 @@ import { getRelatedForumThreads, type RelatedForumThread, } from "@/lib/articles/legacy-source"; -export const revalidate = 3600; +// Deleted or unpublished posts must 404 immediately — never serve a stale +// cached article shell for up to an hour after DB removal. +export const dynamic = "force-dynamic"; +export const revalidate = 0; export const dynamicParams = true; interface PageProps { @@ -90,9 +93,7 @@ export default async function ArticlePage({ params }: PageProps) { const { slug } = await params; const { article, related, relatedForumThreads } = await loadArticle(slug); if (!article) { - // Slug isn't in any of our article tables — send the reader to the news - // index so a click from the homepage/ticker doesn't dead-end on 404. - redirect("/news"); + notFound(); } const articleSchema = {