{formatDate(post.published_at)}
import Link from 'next/link'; import { notFound } from 'next/navigation'; import { ArrowLeft } from 'lucide-react'; import Header from '../../../components/Header.jsx'; import Footer from '../../../components/Footer.jsx'; import Reveal from '../../../components/Reveal.jsx'; import { serverApi } from '../../../lib/serverApi.js'; import { ORGANIZATION_ID } from '../../../lib/schema.js'; function formatDate(iso) { if (!iso) return ''; return new Date(iso).toLocaleDateString('ru-RU', { day: 'numeric', month: 'long', year: 'numeric' }); } export async function generateMetadata({ params }) { const post = await serverApi.getBlogPost(params.slug); if (!post) return { title: 'Статья не найдена' }; return { title: post.title, description: post.excerpt || undefined, alternates: { canonical: `/blog/${params.slug}` }, }; } export default async function BlogPostPage({ params }) { const post = await serverApi.getBlogPost(params.slug); if (!post) notFound(); const articleSchema = { '@context': 'https://schema.org', '@type': 'Article', headline: post.title, ...(post.excerpt ? { description: post.excerpt } : {}), ...(post.published_at ? { datePublished: post.published_at } : {}), author: { '@id': ORGANIZATION_ID }, }; return (
{formatDate(post.published_at)}