first commit
This commit is contained in:
37
app/[locale]/product/[slug]/page.tsx
Normal file
37
app/[locale]/product/[slug]/page.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import ProductPageContent from "../../../../features/products/components/ProductPageContent";
|
||||
|
||||
type Props = {
|
||||
params: { locale: string; slug: string };
|
||||
};
|
||||
export const revalidate = 3600; // ISR: Revalidate every hour
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { locale, slug } = await params;
|
||||
|
||||
return {
|
||||
title: `Product ${slug} | E-Commerce`,
|
||||
description: `View details for product ${slug}`,
|
||||
openGraph: {
|
||||
locale,
|
||||
type: "website",
|
||||
title: `Product ${slug} | E-Commerce`,
|
||||
description: `View details for product ${slug}`,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return [{ slug: "nike-air-max" }, { slug: "adidas-ultraboost" }];
|
||||
}
|
||||
|
||||
export default async function ProductPage(props: Props) {
|
||||
const params = await props.params;
|
||||
|
||||
if (!params.slug) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <ProductPageContent slug={params.slug} />;
|
||||
}
|
||||
Reference in New Issue
Block a user