Files
nobat724_front/components/blog/detail/Caption.js
T
hamed cea8982e6d feat: add script to generate default blog cover image
- Introduced a new script `make-blog-cover.mjs` to create a default cover image for blog posts.
- The image is generated in PNG format with dimensions 1200x630, suitable for Open Graph.
- Utilizes the site's branding colors and logo from `public/nobat724.svg`.
- Includes custom font styling using the Vazirmatn font.
- The generated image is saved to `public/assets/images/blog-default-cover.png`.
2026-07-27 19:07:30 +03:30

38 lines
1.3 KiB
JavaScript

import React from "react";
import Image from "next/image";
import { sanitizeHtml } from "@/lib/sanitize";
import { blogCover } from "@/helper";
function Caption({ data }) {
// هیچ مقاله‌ای بدون تصویر نمایش داده نمی‌شود؛ نبودِ تصویر شاخص یعنی کاور برند.
const cover = blogCover(data);
return (
<>
<div className="relative w-full aspect-video rounded-[8px] overflow-hidden">
<Image
src={cover}
alt={data?.title || "blog cover"}
fill
priority
sizes="(max-width: 1024px) 100vw, 68vw"
className="object-cover"
/>
</div>
{data?.summary && (
<p className="mt-[16px] sm:mt-[20px] pr-[12px] border-r-[3px] border-[#E5E5E5] text-[#3B3B3B] text-[14px] md:text-[15px] lg:text-[16px] font-medium leading-[28px] md:leading-[30px]">
{data.summary}
</p>
)}
{data?.body?.value && (
<div
className="blog-content my-[12px] sm:my-[16px] md:my-[20px] lg:my-[24px] text-[#525252] text-[14px] md:text-[15px] lg:text-[16px] font-normal leading-[26px] sm:leading-[28px] md:leading-[30px] lg:leading-[32px]"
dangerouslySetInnerHTML={{ __html: sanitizeHtml(data.body.value) }}
/>
)}
</>
);
}
export default Caption;