import Image from "next/image"; import Link from "next/link"; import { notFound } from "next/navigation"; import type { Metadata } from "next"; import { getPost, getPosts, postExcerpt, formatDate, readingTime } from "@/lib/ghost"; export const revalidate = 60; // Pre-render every known post at build time; new ones are handled on demand. export async function generateStaticParams() { const posts = await getPosts(); return posts.map((p) => ({ slug: p.slug })); } export async function generateMetadata({ params, }: { params: Promise<{ slug: string }>; }): Promise { const { slug } = await params; const post = await getPost(slug); if (!post) return { title: "Post not found — UP Parivaar Dallas" }; return { title: `${post.title} — UP Parivaar Dallas`, description: postExcerpt(post, 160), openGraph: { title: post.title, description: postExcerpt(post, 160), type: "article", images: post.feature_image ? [{ url: post.feature_image }] : undefined, }, }; } export default async function BlogPostPage({ params, }: { params: Promise<{ slug: string }>; }) { const { slug } = await params; const post = await getPost(slug); if (!post) notFound(); const author = post.primary_author; return (
← All posts
{post.primary_tag && {post.primary_tag.name}}

{post.title}

{author?.profile_image && ( {author.name} )}
{author && {author.name}} {formatDate(post.published_at)} {readingTime(post) && } {readingTime(post) && {readingTime(post)}}
{post.feature_image && (
{post.feature_image_alt
)} {post.html ? (
) : (

{postExcerpt(post, 500)}

)} {post.tags && post.tags.length > 0 && (
{post.tags.map((t) => ( {t.name} ))}
)}
Back to all posts
); }