{titleEn}
{blog.title}
{blog.abstract ? ({blog.abstract}
) : null}import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { BlogCoverImage } from "@/components/BlogCoverImage"; import { ContentPageShell } from "@/components/ContentPageShell"; import { HtmlContent } from "@/components/HtmlContent"; import { ApiNotFoundError, authorName, formatFaDate, getBlog, getBlogCoverImage, } from "@/lib/api"; type BlogDetailPageProps = { params: Promise<{ slug: string }>; }; function stripLeadingCoverImage(html: string, cover: string | null): string { if (!html) return html; let next = html.replace( /^\s*
]*>\s*]*>\s*<\/p>/i,
"",
);
if (cover) {
const escaped = cover.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
next = next.replace(
new RegExp(
`
]*>\\s*
{titleEn}
{blog.abstract}
]*src=["']${escaped}["'][^>]*>\\s*<\\/p>`,
"i",
),
"",
);
}
return next.trim();
}
export async function generateMetadata({
params,
}: BlogDetailPageProps): Promise
{blog.title}
{blog.abstract ? (