does facebook need to actually CRAWL a page for OG to work?

末鹿安然 提交于 2019-12-11 05:56:38

问题


I am attempting to replicate a bit of what Amazon.com is doing. After a person checks out, they are then able to SHARE to the social networks, the product in which they just purchased.

On my site however, facebook won't EVER get to crawl the final booking pages since they are dynamically driven after the user enters their credit card info.

I know the linter could be used for force a decache... but that's really not the story here....

I am of course, refering to the OG information stored in the meta tags.

   <meta property="og:title" content="The Rock"/>
    <meta property="og:type" content="movie"/>
    <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
    <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
    <meta property="og:site_name" content="IMDb"/>
    <meta property="fb:admins" content="USER_ID"/>
    <meta property="og:description"
          content="A group of U.S. Marines, under command of
                   a renegade general, take over Alcatraz and
                   threaten San Francisco Bay with biological
                   weapons."/>

I haven't been able to find ANY clear cut documentation on whether facebook actually needs to CRAWL a page before the opengraph will work or not. If the content above is not on a crawlable page, WILL it still work?

If not? Is there a way around this?


回答1:


Yes, for the Like-Button and Open Graph-Metadata to work, Facebook definitely has to crawl your page (How would it be possible to get the content of your meta-tags otherwise?). Here are the (old) docs on OG-metatags, which gives a good overview:

https://developers.facebook.com/docs/opengraphprotocol/

The idea is, that every object in the graph is represented on a unique URL, containing the OG-metadata. For you app this means, that the dynamically generated booking-pages must be made available to the crawler, f.e. at http://yourapp.com/booking.php?id=45345 you would output these tags:

<meta property="og:title" content="Booking No. 45345"/>
<meta property="og:type" content="order"/>
<meta property="og:description" content="..."/>
<meta property="og:url" content="http://yourapp.com/booking.php?id=45345"/>

The stories generatd by the Like-Button for this URL will than contain a link back to the order-page.

Now, the question is, do you really want booking-pages to be available publicly & permanently? If the answer is "no", than the Like-Button & OG-metatags are probably not the right choice for sharing in your app. You should consider letting your users share stories the Feed-dialogue, which lets you craft individual stories:

https://developers.facebook.com/docs/reference/dialogs/feed/



来源:https://stackoverflow.com/questions/14669313/does-facebook-need-to-actually-crawl-a-page-for-og-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!