import Image from "next/image"; import Link from "next/link"; import { notFound } from "next/navigation"; import Header from "@/components/Header"; import Footer from "@/components/Footer"; import DetailBanner from "@/components/DetailBanner"; import ArticleBody from "@/components/ArticleBody"; import ShareLikeActions from "@/components/ShareLikeActions"; import { getAllBusinessSlugs, getBusinessBlogPost, getBusinessBySlug, } from "@/data/business"; import styles from "./blog.module.css"; export function generateStaticParams() { return getAllBusinessSlugs().flatMap((slug) => { const business = getBusinessBySlug(slug); return (business?.posts ?? []).map((post) => ({ slug, postSlug: post.slug, })); }); } export async function generateMetadata({ params, }: { params: Promise<{ slug: string; postSlug: string }>; }) { const { slug, postSlug } = await params; const data = getBusinessBlogPost(slug, postSlug); if (!data) return { title: "Blog Details | IranBay" }; return { title: `${data.post.title} | Blog Details | IranBay`, description: data.post.intro, }; } export default async function BlogDetailPage({ params, }: { params: Promise<{ slug: string; postSlug: string }>; }) { const { slug, postSlug } = await params; const data = getBusinessBlogPost(slug, postSlug); if (!data) notFound(); const { business, post, related } = data; return (
{post.date} {post.author} {post.category}

{post.title}.

{post.intro}

{post.title}.

); }