0

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
    Aug 30 at 9:19

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.