在“赞"之后,Facebook“赞"按钮不会显示og元数据 [英] Facebook Like Button doesn't show og metadata until after first like

查看:98
本文介绍了在“赞"之后,Facebook“赞"按钮不会显示og元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题与 Facebook建议忽略og:title,直到页面刷新为止几乎相同,但这似乎从未真正解决(不幸的是,该解决方案没有帮助我们).

The issue is nearly identical to Facebook Recommend Ignoring og:title Until Page Refreshed, but that never seemed to really be resolved (and the solution unfortunately did not help us).

我们有成千上万个带有以编程方式生成的赞"按钮的页面.第一次单击喜欢"按钮时,弹出窗口中未包含适当的og标签信息,并且弹出窗口看起来像(带有已编辑的URL)

We have thousands of pages with a programmatically-generated like button. The very first time I click on the like button, the appropriate og-tag information is not included in the popup, and the popup looks like (with URL redacted) http://imgur.com/nWffNY1,UCI76QV#1.

如果我不断刷新页面并喜欢它而不刷新,则该页面同样会损坏.但是,如果我刷新页面,或者什至只是从JavaScript控制台调用FB.XFBML.parse(),然后重新设置页面的外观,信息就会被适当地包含进去,并且看起来像上面专辑中的其他图像(我不会没有足够的声誉来发布3个链接:-().

If I continually unlike and relike the page without refreshing, it is similarly broken. If I refresh the page, though, or even just call FB.XFBML.parse() from the javascript console, and re-like the page, the information is appropriately included, and looks like the other image in the above album (I don't have enough reputation to post 3 links :-( ).

任何以后喜欢一个已经被喜欢的页面(甚至被我自己以外的人喜欢)的页面的尝试都会成功.如果我在 https://developers.facebook.com/tools/debug ,一切看起来都很好,然后尝试使该页面成功显示该信息.似乎一旦Facebook缓存了信息,一切就很好了.

Any subsequent attempt to like a page that has already been liked (even by someone other than myself) succeeds. If I enter the URL for an unliked page into https://developers.facebook.com/tools/debug, everything looks fine, and an attempt to then like the page successfully shows the information. It seems like once Facebook caches the information, things are good.

任何建议将不胜感激!

推荐答案

好像Facebook缓存了信息,一切就很好了.

It seems like once Facebook caches the information, things are good.

是的,当然-这就是它的工作原理.

Yes, of course – this is how it works.

当Facebook遇到新" URL时,它将在其上设置其抓取工具以从中获取信息.但是,在最终用户触发此操作的情况下(例如按钮,提要对话框等),Facebook可能需要太长时间"才能获取信息-因此他们没有UI等待它,因为他们想要快速的用户体验.

When Facebook encounters a "new" URL, it sets its scraper on it to get the information from it. But in cases where this is triggered by the end user (like button, feed dialog, etc.), it may take "too long" for Facebook to get the info – and so they don’t have the UI wait for it, because they want a fast user experience.

您可以对此进行处理(除了使服务器响应速度更快,否则应该成为[1]的瓶颈),是通过API以编程方式请求Facebook抓取您的页面-理想的情况是您可以向网站添加新内容,但是也可以对已经存在一段时间但可能尚未被抓取的页面进行添加.

What you can do about this (apart from making your server respond faster, should(!) it be the bottleneck in this [1]), is to programmatically ask Facebook via API to scrape your pages – ideally at the point where you add new content to your site, but you can also do it for pages that exist for a while already, but might not have been scraped yet.

操作方法如下:更新对象. (如果您打算大量执行此操作,从我所听说的情况来看,建议在这些调用中包含一个应用访问令牌,以免造成限制.)

How that’s done, is described here: Updating Objects. (If you plan to do this in larger quantities, from what I’ve heard it should be advisable to include an app access token with those calls, to avoid throttling.)

[1]如果由于要传递页面而使服务器成为瓶颈,那么您也可以考虑在不同的URL下传递页面的元数据,从而使抓取器的内容要少得多.从服务器上读取数据,也许您的服务器最初要创建的内容较少–为此,请参见同一链接的文档,使用指针处理大型对象"部分

[1] If your server is the bottleneck because you are delivering large pages, you could also consider delivering the meta data for your pages under different URLs, so that the scraper has much less content to read from your server and maybe your server has less content to create in the first place – for that, see the same linked document, section "Handling Large Objects With Pointers"

这篇关于在“赞"之后,Facebook“赞"按钮不会显示og元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆