The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
www: properly surface not-found blog slugs (#45537)
Charis29820d830991
diff --git a/apps/www/app/blog/[slug]/page.tsx b/apps/www/app/blog/[slug]/page.tsxindex 62d7ceb9ec3..8d2cb7ded2a 100644--- a/apps/www/app/blog/[slug]/page.tsx+++ b/apps/www/app/blog/[slug]/page.tsx@@ -1,5 +1,6 @@import type { Metadata } from 'next'import { draftMode } from 'next/headers'+import { notFound } from 'next/navigation'import BlogPostClient from './BlogPostClient'import authors from '@/lib/authors.json'@@ -181,6 +182,8 @@ export default async function BlogPostPage({ params }: { params: Promise<Params></>)} catch (err) {+ if (err instanceof Error && (err as Error & { code?: string }).code === 'POST_NOT_FOUND')+ notFound()throw err}}diff --git a/apps/www/lib/posts.tsx b/apps/www/lib/posts.tsxindex 6615fe0bc2d..da6b466aad1 100644--- a/apps/www/lib/posts.tsx+++ b/apps/www/lib/posts.tsx@@ -1,6 +1,7 @@import fs from 'fs'-import matter from 'gray-matter'import path from 'path'+import matter from 'gray-matter'+import { validateBlogFrontmatterImages } from './blog-images'import { generateReadingTime } from './helpers'@@ -172,6 +173,10 @@ export const getPostdata = async (slug: string, directory: string) => {*/const found = folderfiles.filter((x) => x.includes(slug))[0]+ if (!found) {+ throw Object.assign(new Error(`Post not found: ${slug}`), { code: 'POST_NOT_FOUND' })+ }+const fullPath = path.join(postDirectory, found)const postContent = fs.readFileSync(fullPath, 'utf8')