mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
updating /products
to /wardrobe
This commit is contained in:
55
app/wardrobe/[handle]/sku/page.tsx
Normal file
55
app/wardrobe/[handle]/sku/page.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { ProductSKUs } from "components/product/sku-generator";
|
||||
import { HIDDEN_PRODUCT_TAG } from "lib/constants";
|
||||
import { getProduct } from "lib/shopify";
|
||||
import { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata({
|
||||
params
|
||||
}: {
|
||||
params: { handle: string };
|
||||
}): Promise<Metadata> {
|
||||
const product = await getProduct(params.handle);
|
||||
|
||||
if (!product) return notFound();
|
||||
|
||||
const { url, width, height, altText: alt } = product.featuredImage || {};
|
||||
const hide = !product.tags.includes(HIDDEN_PRODUCT_TAG);
|
||||
|
||||
return {
|
||||
title: product.seo.title || product.title,
|
||||
description: product.seo.description || product.description,
|
||||
robots: {
|
||||
index: hide,
|
||||
follow: hide,
|
||||
googleBot: {
|
||||
index: hide,
|
||||
follow: hide
|
||||
}
|
||||
},
|
||||
openGraph: url
|
||||
? {
|
||||
images: [
|
||||
{
|
||||
url,
|
||||
width,
|
||||
height,
|
||||
alt
|
||||
}
|
||||
]
|
||||
}
|
||||
: null
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ViewSKUs({ params }: { params: { handle: string } }) {
|
||||
const product = await getProduct(params.handle);
|
||||
|
||||
if (!product) return
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProductSKUs productTitle={product.title} noTitle={true} />
|
||||
</>
|
||||
)
|
||||
};
|
Reference in New Issue
Block a user