fix: final final v2

This commit is contained in:
Lucas Smith
2024-03-14 10:39:48 +00:00
parent f5967e28c3
commit 0db2e6643d

View File

@@ -28,11 +28,11 @@ export const generateMetadata = ({ params }: { params: { post: string } }) => {
}); });
// Use the url constructor to ensure that things are escaped as they should be // Use the url constructor to ensure that things are escaped as they should be
const openGraphImageUrl = new URL(`${blogPost.href}/opengraph`); const searchParams = new URLSearchParams({
title: blogPost.title,
openGraphImageUrl.searchParams.set('title', blogPost.title); author: blogPost.authorName,
openGraphImageUrl.searchParams.set('author', blogPost.authorName); sig: signature,
openGraphImageUrl.searchParams.set('sig', signature); });
return { return {
title: { title: {
@@ -40,10 +40,10 @@ export const generateMetadata = ({ params }: { params: { post: string } }) => {
}, },
description: blogPost.description, description: blogPost.description,
openGraph: { openGraph: {
images: [openGraphImageUrl.toString()], images: [`${blogPost.href}/opengraph?${searchParams.toString()}`],
}, },
twitter: { twitter: {
images: [openGraphImageUrl.toString()], images: [`${blogPost.href}/opengraph?${searchParams.toString()}`],
}, },
}; };
}; };