Next.js Discord

Discord Forum

Discord Metadata in Nextjs

Answered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
How can i use these:
<meta name="description" content="<%= description %>"/>
<meta property="og:image" content="<%= icon %>" />
<meta property="og:url" content="<%= link %>" />
<meta property="og:site_name" content="<%= title+'B' %>" />
<meta property="og:type" content="website" />
<meta data-react-helmet="true" name="theme-color" content="<%= '#'+color %>"/>
In Nextjs 14 Metadata?
export const metadata = {
title: '123',
description: '123',
}

ping me on anything new pls, thanks
Answered by !=tgt
export const metadata: Metadata = {
  title: "123",
  description: "123",
  openGraph: {
    images: "imageurlhere",
    url: "url",
    // and so on
    }
}
View full answer

10 Replies

Answer
@!=tgt tsx export const metadata: Metadata = { title: "123", description: "123", openGraph: { images: "imageurlhere", url: "url", // and so on } }
West African Lion
I'm running into the same issue and can't get the preview images to show up in Discord, but they work elsewhere. I have setup the metadata but doesn't work 😦
@riský can you open your own thread with what you tried/code and the error (also try it in https://discord.com/developers/embeds)
West African Lion
Here is the thread with all of my code and what I did to fix the other image previews that didn't work for discord
https://nextjs-forum.com/post/1207080094774857760#message-1207116725154480159

I tried the discord developer link, but it doesn't show how to generate an image preview, just text which currently works so maybe that's a limitation or something?
@West African Lion I'm running into the same issue and can't get the preview images to show up in Discord, but they work elsewhere. I have setup the metadata but doesn't work 😦
Giant pandaOP
For me, using images: "/public/xxx.png", didn't work, but using images: "https://yourserver.com/xxx.png", did work.
Cuckoo wasp
I always app/opengraph-image.png and set metabaseurl
:sunglasses_1: