Converts to Opengraph Image file convention. (#1043)

This commit is contained in:
Michael Novotny
2023-06-07 20:57:31 -05:00
committed by GitHub
parent e4fcf19321
commit 87c385fcd6
9 changed files with 75 additions and 77 deletions

View File

@@ -0,0 +1,11 @@
import OpengraphImage from 'components/opengraph-image';
import { getCollection } from 'lib/shopify';
export const runtime = 'edge';
export default async function Image({ params }: { params: { collection: string } }) {
const collection = await getCollection(params.collection);
const title = collection?.seo?.title || collection?.title;
return await OpengraphImage({ title });
}

View File

@@ -20,16 +20,7 @@ export async function generateMetadata({
return {
title: collection.seo?.title || collection.title,
description:
collection.seo?.description || collection.description || `${collection.title} products`,
openGraph: {
images: [
{
url: `/api/og?title=${encodeURIComponent(collection.title)}`,
width: 1200,
height: 630
}
]
}
collection.seo?.description || collection.description || `${collection.title} products`
};
}