2025-02-12 14:22:55 +07:00
|
|
|
import { BeforeFooterBlock } from "@/components/Blocks/BeforeFooter";
|
2025-02-05 22:17:43 +07:00
|
|
|
import BlogDetail, { BlogDetailContentSkeleton } from "@/components/Blogs/BlogDetail";
|
2025-02-03 12:13:56 +07:00
|
|
|
import { fetchBlogDetail } from "@/services/payload/blog";
|
2025-02-03 09:09:21 +07:00
|
|
|
import { Metadata } from "next";
|
2025-02-03 12:13:56 +07:00
|
|
|
import Image from "next/image";
|
2025-02-05 22:17:43 +07:00
|
|
|
import { Suspense } from "react";
|
2025-02-03 09:09:21 +07:00
|
|
|
|
2025-02-03 15:20:09 +07:00
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
2025-02-12 10:42:17 +07:00
|
|
|
const name = "Cochise Oncology";
|
2025-02-03 15:20:09 +07:00
|
|
|
const slug = (await params).slug;
|
|
|
|
const blog = await fetchBlogDetail(slug);
|
2025-02-03 09:09:21 +07:00
|
|
|
|
|
|
|
if (!blog) {
|
|
|
|
return {
|
2025-02-12 10:42:17 +07:00
|
|
|
title: name,
|
|
|
|
description: name,
|
2025-02-03 09:09:21 +07:00
|
|
|
openGraph: {
|
2025-02-12 10:42:17 +07:00
|
|
|
title: name,
|
|
|
|
description: name,
|
2025-02-03 09:09:21 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2025-02-12 14:22:55 +07:00
|
|
|
const title = `${!!blog.data?.meta?.title ? blog.data?.meta?.title : blog.data.title} - ${name}`;
|
|
|
|
const description = `${!!blog.data?.meta?.description ? blog.data?.meta?.description : blog.data.title} - ${name}`;
|
2025-02-03 09:09:21 +07:00
|
|
|
|
|
|
|
return {
|
|
|
|
title: title,
|
2025-02-12 14:22:55 +07:00
|
|
|
description: description,
|
2025-02-03 09:09:21 +07:00
|
|
|
openGraph: {
|
|
|
|
title: title,
|
2025-02-12 14:22:55 +07:00
|
|
|
description: description,
|
2025-02-05 22:17:43 +07:00
|
|
|
images: [{ url: blog.imgUrl }],
|
2025-02-03 09:09:21 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2025-02-03 14:17:13 +07:00
|
|
|
export default async function SingleBlogPage({ params }: { params: Promise<{ slug: string }> }) {
|
2025-02-03 09:09:21 +07:00
|
|
|
const slug = (await params).slug;
|
|
|
|
|
2025-02-05 22:17:43 +07:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Suspense fallback={<Loading />}>
|
|
|
|
<BlogDetail slug={slug} />
|
2025-02-12 14:22:55 +07:00
|
|
|
<BeforeFooterBlock />
|
2025-02-05 22:17:43 +07:00
|
|
|
</Suspense>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2025-02-03 03:19:32 +07:00
|
|
|
|
2025-02-05 22:17:43 +07:00
|
|
|
function Loading() {
|
2025-02-03 03:19:32 +07:00
|
|
|
return (
|
|
|
|
<>
|
2025-02-03 14:17:13 +07:00
|
|
|
<section className="page-section bg-dark-1 bg-gradient-gray-dark-1 light-content bg-scroll overflow-hidden">
|
2025-02-03 03:19:32 +07:00
|
|
|
{/* <!-- Background Shape --> */}
|
2025-02-03 14:17:13 +07:00
|
|
|
<div className="bg-shape-1 opacity-003">
|
|
|
|
<Image src="/assets/images/demo-fancy/bg-shape-1.svg" width={1443} height={844} alt="" />
|
2025-02-03 03:19:32 +07:00
|
|
|
</div>
|
|
|
|
{/* <!-- End Background Shape --> */}
|
|
|
|
</section>
|
2025-02-03 14:17:13 +07:00
|
|
|
|
2025-02-05 22:17:43 +07:00
|
|
|
{/* Section */}
|
|
|
|
<BlogDetailContentSkeleton />
|
|
|
|
{/* End Section */}
|
2025-02-03 03:19:32 +07:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|