2

I am using %PUBLIC_URL% to load the image in index.html for meta purpose, like this

<meta property="og:image" content="%PUBLIC_URL%/image.png" />

And when inspecting the elements, I can see it is loaded in relative path inside the head.

<head>
    <meta property="og:image" content="/og-image.png">
</head>

The problem is, og:image requires an absolute path as facebook debugger warned, “og:image provided is not a valid url”. So how do I get an absolute path with %PUBLIC_URL%?

For some reasons, facebook can still get the thumbnail image despite the warning. But I still want to find a way to solve this.

1
  • Setting this using client-side code is pointless to begin with - the Facebook scraper does not execute any JavaScript.
    – CBroe
    Commented Aug 30, 2023 at 9:19

0