From 3395e6ebf853c6ec43d06000d5d450e0ccc7f736 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 3 Jun 2026 15:57:38 +0200 Subject: [PATCH] chore: move debug route out of /api to avoid Payload CMS interception --- apps/web/app/debug-mdx/route.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 apps/web/app/debug-mdx/route.ts diff --git a/apps/web/app/debug-mdx/route.ts b/apps/web/app/debug-mdx/route.ts new file mode 100644 index 0000000..7ed34f7 --- /dev/null +++ b/apps/web/app/debug-mdx/route.ts @@ -0,0 +1,30 @@ +import { NextResponse } from "next/server"; +import { revalidatePath } from "next/cache"; +import fs from "fs"; +import path from "path"; + +export async function GET() { + try { + const POSTS_DIR = path.join(process.cwd(), "content/blog"); + let files = []; + if (fs.existsSync(POSTS_DIR)) { + files = fs.readdirSync(POSTS_DIR); + } + + // Revalidate the two problematic pages + revalidatePath("/blog/website-as-a-service"); + revalidatePath("/blog/zero-overhead-agencies"); + revalidatePath("/blog"); // also bust the blog list cache + + return NextResponse.json({ + success: true, + cwd: process.cwd(), + postsDir: POSTS_DIR, + postsDirExists: fs.existsSync(POSTS_DIR), + files: files, + message: "Cache revalidated for specific paths", + }); + } catch (err: any) { + return NextResponse.json({ success: false, error: err.message }); + } +}