105 lines
3.3 KiB
JavaScript
105 lines
3.3 KiB
JavaScript
import Layout from "@/components/layout/Layout";
|
|
import Link from "next/link";
|
|
import { notFound } from "next/navigation";
|
|
import Accident from "@/utils/Accident.utils";
|
|
|
|
// ✅ Generate static paths for export
|
|
export async function generateStaticParams() {
|
|
return Accident.map((item) => ({
|
|
slug: item.slug,
|
|
}));
|
|
}
|
|
|
|
export async function generateMetadata({ params }) {
|
|
const service = Accident.find((item) => item.slug === params.slug);
|
|
|
|
if (!service) {
|
|
return {
|
|
title: "Accident Services | MySite",
|
|
description: "Explore our accident-related services",
|
|
};
|
|
}
|
|
|
|
return {
|
|
title: service.metaTitle || service.title,
|
|
description: service.metaDescription || service.shortDesc,
|
|
};
|
|
}
|
|
|
|
export default function AccidentDetailsPage({ params }) {
|
|
const service = Accident.find((item) => item.slug === params.slug);
|
|
|
|
if (!service) return notFound();
|
|
|
|
return (
|
|
<Layout
|
|
headerStyle={1}
|
|
footerStyle={1}
|
|
breadcrumbTitle={`${service.title}`}
|
|
bannerImage={service.bannerImage}
|
|
>
|
|
<section className="service-details pt_90 pb_90">
|
|
<div className="auto-container">
|
|
<div className="row clearfix">
|
|
|
|
{/* Sidebar */}
|
|
<div className="col-lg-4 col-md-12 col-sm-12 sidebar-side">
|
|
<div className="default-sidebar service-sidebar mr_15">
|
|
|
|
{/* Categories */}
|
|
<div className="sidebar-widget category-widget">
|
|
<div className="widget-title"><h3>Accident</h3></div>
|
|
<div className="widget-content">
|
|
<ul className="category-list clearfix">
|
|
{Accident.map((cat) => (
|
|
<li key={cat.id}>
|
|
<Link
|
|
href={`/accident/${cat.slug}`}
|
|
className={cat.slug === service.slug ? "current" : ""}
|
|
>
|
|
{cat.title}
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Service Card */}
|
|
<div className="service-block-one">
|
|
<div className="inner-box">
|
|
<div className="image-box">
|
|
<figure className="image">
|
|
<img src={service.mainImage} alt={service.title} />
|
|
</figure>
|
|
</div>
|
|
<div className="lower-content">
|
|
<div className="icon-box">
|
|
<img src={service.icon} alt={`${service.title}`} />
|
|
</div>
|
|
<h3>{service.title}</h3>
|
|
<p>{service.shortDesc}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{/* Content */}
|
|
<div className="col-lg-8 col-md-12 col-sm-12 content-side">
|
|
<div className="service-details-content">
|
|
<div
|
|
className="service-details-description"
|
|
dangerouslySetInnerHTML={{ __html: service.content }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</Layout>
|
|
);
|
|
}
|