import { mockDb } from '@/lib/mockDb' import { Link } from '@/i18n/routing' import { notFound } from 'next/navigation' import { Calendar, Tag, ArrowLeft } from 'lucide-react' import ListingCard from '@/components/ListingCard' import { renderMarkdownToHtml } from '@/lib/markdown' import Image from 'next/image' import type { Metadata } from 'next' interface Props { params: Promise<{ locale: string; slug: string }> } export async function generateMetadata({ params }: Props): Promise { const { locale, slug } = await params const post = await mockDb.getBlogPostBySlug(slug) if (!post) return {} const title = locale === 'en' ? post.titleEn : locale === 'ru' ? post.titleRu : post.titleTr const content = locale === 'en' ? post.contentEn : locale === 'ru' ? post.contentRu : post.contentTr const description = content.substring(0, 150) const fullTitle = `${title} — Marmaris Local` return { title: fullTitle, description, openGraph: { title: fullTitle, description, type: 'article', ...(post.coverImage ? { images: [{ url: post.coverImage }] } : {}), }, twitter: { card: 'summary_large_image', title: fullTitle, description, }, } } export default async function BlogPostDetailPage({ params }: Props) { const { locale, slug } = await params const post = await mockDb.getBlogPostBySlug(slug) if (!post || post.deletedAt) { notFound() } const title = locale === 'en' ? post.titleEn : locale === 'ru' ? post.titleRu : post.titleTr const content = locale === 'en' ? post.contentEn : locale === 'ru' ? post.contentRu : post.contentTr const htmlContent = renderMarkdownToHtml(content) // Fetch associated listings const relatedListings: any[] = [] if (post.relatedListingIds && post.relatedListingIds.length > 0) { for (const listingId of post.relatedListingIds) { const listing = await mockDb.getListingById(listingId) if (listing) { relatedListings.push(listing) } } } // schema.org Structured Data const jsonLd = { '@context': 'https://schema.org', '@type': 'Article', 'headline': title, 'image': post.coverImage || 'https://images.unsplash.com/photo-1504674900247-0877df9cc836?w=1200&auto=format&fit=crop&q=80', 'datePublished': post.publishedAt || post.createdAt, 'dateModified': post.updatedAt, 'author': { '@type': 'Organization', 'name': 'Marmaris Local', 'url': 'https://marmarislocal.com' }, 'publisher': { '@type': 'Organization', 'name': 'Marmaris Local', 'logo': { '@type': 'ImageObject', 'url': 'https://marmarislocal.com/logo.png' } }, 'description': content.substring(0, 150) } return ( <> {/* Schema.org Article Structured Data */}