mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
* show cms blog posts in www * remove contentlayer from www * outputFileTracingExcludes * update remotePatterns * fetch cms posts server-side with revalidation * add cms env vars to turbo.json * add www env vars to turbo.json * include cms posts in www sitemap * add migration to remove image from cms post * update cms meta image mapping in www
16 lines
471 B
TypeScript
16 lines
471 B
TypeScript
import { draftMode } from 'next/headers'
|
|
import { redirect } from 'next/navigation'
|
|
|
|
export async function GET(request: Request) {
|
|
const draft = await draftMode()
|
|
const { searchParams } = new URL(request.url)
|
|
const slug = searchParams.get('slug')
|
|
const path = searchParams.get('path') || 'blog'
|
|
|
|
// Disable Draft Mode by clearing the cookie
|
|
draft.disable()
|
|
|
|
// Redirect to the path from the fetched post
|
|
redirect(slug ? `/${path}/${slug}` : `/${path}`)
|
|
}
|