Facebook Like button og:image needs to be scraped to be displayed
I've got a Drupal website with articles on them which have Facebook like buttons.
Now I've got all the OpenGraph metatags added开发者_如何学Python on the pages and it's all working perfectly except for one thing.
Site visitors can share a page URL or like a page URL.
When a new article is added and the first person who presses the like button will not see the image added in the og:image
tag.
If another person afterwards presses the like button, the og:image
however is visible so it seems to me Facebook needs to scrape the page first before the og:image
is added in the 'Facebook Like window'.
The Facebook share doesn't seem to suffer from this problem and does it right from the first time.
Now whenever somebody adds a new article, I'd need the URL of the article to be scraped automatically by Facebook using some PHP code or some other fix...
Anyone who knows if autoscraping a URL is possible or does anyone have an idea for a workaround?
You can use the graph API with scrape=true
to force Facebook to scrape you right when you create your contents
https://developers.facebook.com/docs/beta/opengraph/objects/
精彩评论