Open Graph images not working anymore after updating to Next 13, despite being present in the HTML #50546
Replies: 6 comments 13 replies
-
Hi, I do believe you are using Most precisely, your page is crashing when rendering on the server. How do I know this? Well I looked at the HTML sent by the server, and it is errored HTML. Your app is then hydrated client side, and it looks like it works. Naturally bots miss out on this. So, tell me, where do you think the app is crashing on the server? Are you perhaps using |
Beta Was this translation helpful? Give feedback.
-
It's happening with me too. I can see things set on the final HTML but it's not working when I share link on Whatsapp. |
Beta Was this translation helpful? Give feedback.
-
I'm having a similar issue. I'm currently using
This seems to fix the issue for now (though again, according to the documentation, doesn't seem like it should be required in order for this to work). |
Beta Was this translation helpful? Give feedback.
-
Hi for me it was not having: metadataBase: new URL("https://baseUrl") in my metadata, found this on stack overflow: https://stackoverflow.com/questions/76569441/next-js-13-og-image-not-working-when-i-put-it-in-app-directory |
Beta Was this translation helpful? Give feedback.
-
Turns out, the file size of the og:image could be a problem. You can use tools like image smaller to compress images without losing quality. For dynamically generated opengraph-image, try using image compression libraries like sharp |
Beta Was this translation helpful? Give feedback.
-
Hello, after digging for a while, i found the root cause! Your production domain is just a custom domain, pointing to the result of the deployment of this commit, which is originally built targeting a commit-based domain. When configuring the OpenGraph, for instance using the method mentioned in this issue report, I believe the author defining the url path for the OpenGraph images using relative URL. According to this section of NextJS document, if the To resolve this, the official way is that we can created another environment variable, (which should not HAVE THE SAME name with any Vercel system environment variables), let's called it // layout.tsx
// ...
import type { Metadata } from "next";
const defaultUrl = process.env.PROD_URL
? `https://${process.env.PROD_URL}`
: "http://localhost:3000";
export const metadata: Metadata = {
metadataBase: new URL(defaultUrl),
// your other metadata (e.g. OpenGraph, etc.) go here
} Then, in your Vercel Environment settings, add a environment variables named Here are a few other important notes:
Hope this help! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Since upgrading to the latest 13 version, I have encountered an issue where my Open Graph images are no longer appearing when I share my page. Interestingly, the images are present in the HTML code. I am using the metadata object inside the layout.ts
Here is the link to the page: https://varos.com.br/vza
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions