Next.js Discord

Discord Forum

opengraph static image

Answered
Marble gall posted this in #help-forum
Open in Discord
Marble gallOP
Hello all,
I want to use the same image always for opengraph and I thought I could use something like this in my components:
        <meta
          property="og:image"
          content="https://www.mydomain.com/images/og.png"
        />


However, mydomain.com/images does not exist. What should I put in content? The og.png file is in the public/images folder and I deploy Nextjs within Docker as a standalone.

Thank you in advance and regards
Answered by riský
that one is just optimized (smaller size for user)
View full answer

14 Replies

put whatever your url is...
as you are doing docker, you must know what your domains is
Marble gallOP
I would say the problem is that I am not sure how the images are translated when all is bundled. I mean my logo is public/logo.png but then when the app is deployed the link seems to be "https://mydomain.com/_next/image?url=%2Flogo.png&w=64&q=75" so ideally, I would need a relative link within content
that one is just optimized (smaller size for user)
Answer
Marble gallOP
oh I think I see the problem, so if it is under the public folder I can see it as you mentioned i.e. mydomain.com/whateverimage.png However, it seems that if the image is under public/images then I cannot access mydomain.com/images/whateverimage.pn
anything can be seen in public... even folders i thought?
Marble gallOP
I am going to check now but apparently not nested folders
Marble gallOP
I can see the og image in mydomain.com/og.png but the opengraph plugin does not seen the image I am going to continue searching about this and I will leave what I find just for future people
Marble gallOP
ok it works now, so I have left mydomain.com/og.png and that is ok though I would like in future something under the images folder/whatsoever. The problem I was having is I was putting as url https://www.mydomain.com/og.png and because of how I have the redirects and so on it was not working nicely with https. So I have changed the url to https:mydomain.com/og.png
thanks for the help!
not sure what to mark as solution though
I will mark you, you gave me the initial clue