import { notFound } from 'next/navigation'; import Link from 'next/link'; import Header from '@/components/Header'; import Footer from '@/components/Footer'; import { getArticle } from '@/lib/engine'; import { renderMarkdown, formatDate } from '@/lib/markdown'; import { Clock, ArrowLeft } from 'lucide-react'; export const revalidate = 60; export async function generateMetadata({ params }) { const { slug } = await params; const article = await getArticle(slug); if (!article) return { title: 'Статья не найдена' }; return { title: article.seo_title || article.title, description: article.seo_descr || article.excerpt, openGraph: { title: article.title, description: article.excerpt, type: 'article', publishedTime: article.published_at, tags: article.tags || [], }, }; } export default async function ArticlePage({ params }) { const { slug } = await params; const article = await getArticle(slug); if (!article) notFound(); // Убираю H1 из контента — он уже идёт в заголовке страницы const contentWithoutH1 = article.content.replace(/^#\s+.+$/m, '').trim(); const html = renderMarkdown(contentWithoutH1); return ( <>
Все статьи
{(article.tags || []).map(t => ( #{t} ))}

{article.title}

{article.author} · {formatDate(article.published_at)} {article.reading_time && ( <> · {article.reading_time} мин чтения )}

Хочешь такой же блог или канал в Telegram?

Открыть ZeroPost