next.jsnext.js13

Next.js 13 og image not working when I put it in app directory


"I read the documentation, which states to add an opengraph-image.(jpg|jpeg|png|gif) image file to any route segment. I placed my opengraph-image.png in the root directory of my app, but after building it, it didn't generate the og image tag for me. Any ideas? enter image description here

I hope it can generated og image tag for me in index.html


Solution

  • I solve this by add metadataBase in metadata

    export const metadata = {
      title: "Next Dashboard",
      description: "Dashboard wrote in Next.js",
      metadataBase: new URL("https://next-dashboard.pinkjelly.org/"),
    };