import Link from '@/components/LocalizedLink' import Image from 'next/image' import { notFound } from 'next/navigation' import type { Metadata } from 'next' import { generateSeoMetadata } from '@/lib/seo' import { ArrowLeft } from 'lucide-react' import type { Article } from '@homaroma/types' import { API_BASE } from '@/lib/api' async function getArticle(slug: string): Promise
{ try { const res = await fetch(`${API_BASE}/articles/${slug}`, { next: { revalidate: 300 } }) return res.ok ? res.json() : null } catch { return null } } export async function generateMetadata({ params }: { params: Promise<{ slug: string, lang: string }> }): Promise { const { slug, lang } = await params const article = await getArticle(slug) if (!article) return { title: 'Article Not Found' } return generateSeoMetadata({ title: `${article.title} Scent Guide`, description: article.content.replace(/<[^>]+>/g, '').slice(0, 160), path: `/article/${slug}`, lang, openGraph: { title: article.title, images: article.coverImage ? [article.coverImage] : [], type: 'article', publishedTime: article.createdAt, }, }) } export default async function ArticleReaderPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params const article = await getArticle(slug) if (!article) notFound() return (
Go Back

{new Date(article.createdAt).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}

{article.title}

{article.coverImage && (
{article.title}
)}
) }