fix OG images again

This commit is contained in:
Jack 2023-06-21 13:03:38 -07:00
parent f081435b17
commit 261fa687ea
No known key found for this signature in database
GPG Key ID: AFD9F14834097B8E
2 changed files with 8 additions and 0 deletions

View File

@ -111,6 +111,8 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
const post = schema.parse(await client.fetch(query))[0]; const post = schema.parse(await client.fetch(query))[0];
const r = post.mainImage?.match(/(?<width>\d+)x(?<height>\d+)/);
return { return {
title: post.title, title: post.title,
description: post.subtitle, description: post.subtitle,
@ -124,6 +126,8 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
images: [ images: [
{ {
url: post.mainImage, url: post.mainImage,
width: parseInt(r?.groups?.width ?? "400"),
height: parseInt(r?.groups?.height ?? "400"),
}, },
], ],
}, },

View File

@ -115,6 +115,8 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
const project = projectSchema.parse(await client.fetch(projectQuery))[0]; const project = projectSchema.parse(await client.fetch(projectQuery))[0];
const r = project.mainImage?.match(/(?<width>\d+)x(?<height>\d+)/);
return { return {
title: project.title, title: project.title,
description: project.subtitle, description: project.subtitle,
@ -128,6 +130,8 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
images: [ images: [
{ {
url: project.mainImage, url: project.mainImage,
width: parseInt(r?.groups?.width ?? "400"),
height: parseInt(r?.groups?.height ?? "400"),
}, },
], ],
}, },