I am trying to share an image from my website on facebook. The image can be dynamic, but other meta will remain the same.
Is there a way I can have dynamic data in OG:IMAGE tag, or will I have to go with the other option of FB Post APIs.
You can change og:image with following code: $('meta[name=og\\:image]'). attr('content', newVideoUrl); But, if you want to change the image permanently (so Facebook can scrape your data and the image will be available for sharing), you need to change this value on the server.
The 'og:' in your website's HTML code stands for 'Open Graph'. It is an acronym of an Open Graph protocol which enables you to tell Facebook how your shared content should be displayed.
The most frequently recommended resolution for an OG image is 1200 pixels x 627 pixels (1.91/1 ratio). At this size, your thumbnail will be big and stand out from the crowd. Just don't exceed the 5MB size limit.
An open graph image or OG image is the image that appears when you post a link to a web page or video content on your social media page. This forms part of an important group of meta tags that directly impact how the content links perform on social media platforms, like Facebook, LinkedIn and Twitter.
Yes and no. Facebook scrapes your site once, and cached the metadata that it finds, unless you specifically go here and force the scraper to crawl your site again. The cache does generally expire (perhaps after 1-2 days?), so when requested again outside of this cache period, Facebook will crawl the site again.
You can have a dynamically generated og:image
meta tag, but it will only be read the one time (per cache period), and only that instance of the image will be saved.
For example, if user A shares your page, and your page returns imageA.png
in the og:image
tag, then that is the image that will be associated with your page's metadata.
If user B then shares the same page within the same cache period, Facebook will forgo the metadata scraping and assume that imageA.png
is still a valid og:image
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With