fix(products): update links redirecting to product

https://github.com/vercel/commerce/issues/1285
This commit is contained in:
tonytangdev 2024-01-25 21:37:24 +01:00
parent d5e2453bc5
commit 68ed96e28a
5 changed files with 11 additions and 5 deletions

View File

@ -28,7 +28,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const productsPromise = getProducts({}).then((products) =>
products.map((product) => ({
url: `${baseUrl}/product/${product.handle}`,
url: `${baseUrl}/products/${product.handle}`,
lastModified: product.updatedAt
}))
);

View File

@ -19,7 +19,7 @@ export async function Carousel() {
key={`${product.handle}${i}`}
className="relative aspect-square h-[30vh] max-h-[275px] w-2/3 max-w-[475px] flex-none md:w-1/3"
>
<Link href={`/product/${product.handle}`} className="relative h-full w-full">
<Link href={`/products/${product.handle}`} className="relative h-full w-full">
<GridTileImage
alt={product.title}
label={{

View File

@ -91,7 +91,7 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) {
});
const merchandiseUrl = createUrl(
`/product/${item.merchandise.product.handle}`,
`/products/${item.merchandise.product.handle}`,
new URLSearchParams(merchandiseSearchParams)
);

View File

@ -16,7 +16,10 @@ function ThreeItemGridItem({
<div
className={size === 'full' ? 'md:col-span-4 md:row-span-2' : 'md:col-span-2 md:row-span-1'}
>
<Link className="relative block aspect-square h-full w-full" href={`/product/${item.handle}`}>
<Link
className="relative block aspect-square h-full w-full"
href={`/products/${item.handle}`}
>
<GridTileImage
src={item.featuredImage.url}
fill

View File

@ -8,7 +8,10 @@ export default function ProductGridItems({ products }: { products: Product[] })
<>
{products.map((product) => (
<Grid.Item key={product.handle} className="animate-fadeIn">
<Link className="relative inline-block h-full w-full" href={`/product/${product.handle}`}>
<Link
className="relative inline-block h-full w-full"
href={`/products/${product.handle}`}
>
<GridTileImage
alt={product.title}
label={{