generateMetadata not working
Answered
Lukas posted this in #help-forum
LukasOP
I'm working on a website using
Using heymeta (metadata checker) it displays what I assume it should: https://www.heymeta.com/url/rovemc.org/blog/b0e9b1f8-54ac-4858-b8a2-b914b71b2900
Here's my code:
Is this a bug or am I doing something wrong?
generateMetadata()
, but it doesn't seem to work on discord (https://rovemc.org/blog/b0e9b1f8-54ac-4858-b8a2-b914b71b2900) or [on twitter](https://twitter.com/quick007YT/status/1675236093443317760). Using heymeta (metadata checker) it displays what I assume it should: https://www.heymeta.com/url/rovemc.org/blog/b0e9b1f8-54ac-4858-b8a2-b914b71b2900
Here's my code:
const title = postInfo.properties.title.title[0].plain_text;
const description = `An article from Amethyst Realms. Posted ${formatDate(
/* @ts-expect-error Mistyped JSON*/
new Date(postInfo.created_time)
)}`;
/* @ts-expect-error Mistyped JSON*/
const banner = postInfo.cover
/* @ts-expect-error Mistyped JSON*/
? postInfo.cover[postInfo.cover.type].url
: "https://rove-website.vercel.app/logos/amethyst-banner.png";
return {
title,
description,
openGraph: {
title,
description,
url: "https://rovemc.org/stats",
siteName: "Amethyst Realms",
images: [
{
url: banner,
},
],
locale: "en_US",
type: "website",
},
twitter: {
card: "summary_large_image",
title,
description,
images: [
{
url: banner,
},
],
},
};
}
Is this a bug or am I doing something wrong?