为什么 Facebook 返回错误的页面(影响 Facebook Like 和 Share URL)?
当我们第一次发布博客文章时,Facebook 经常(但并非总是)对页面是什么感到困惑。具体来说,如果您尝试使用博客页面上的“赞”按钮,或者尝试通过个人资料上的“共享”链接进行共享,Facebook 将看到根博客页面而不是实际的帖子页面。
例如,我们最近发布了: http://thisorthat.com/blog/2010-song -of-the-year-round-1-results
如果用户“喜欢”它,它会返回以下内容的标题: "http://thisorthat.com/blog"
当您通过 FB Linter 运行帖子 URL 时,您可以看到问题。 “http://developers.facebook.com/tools/linter?url=http://thisorthat.com/blog/2010-song-of-the-year-round-1-results"
在“调试”部分中,它显示额外的 og:title、og:url、说明和 og:image(“调试”部分的最后 4 行)。这是来自根目录的元数据。我们无法弄清楚的是为什么。为什么 Facebook 在页面上看到正确的元数据,然后还从根目录中提取元数据(并错误地使用它来填充“赞”按钮和“共享 URL”工具的数据)?
另一件奇怪的事。几天后,FB“弄清楚了”。当然,到那时查看该帖子的人相对较少。
更新——我想再次感谢 Peter Bailey 的回答,但我们还发现在“赞”按钮起作用之前我们必须解决另一个问题。
问题是我们在尚未发布的帖子上显示 Facebook“点赞”按钮。这样做的问题是 FB 无法解析该 URL 并“猜测”正确的 URL。在我们的例子中,它总是猜测 thisorthat.com/blog。不幸的是,它会将猜测缓存几天,并且 Linter 无法清除该缓存。因此,最终的解决方案是按照 Peter 的建议修复 og:type,同时从博客文章预览中删除 Like 按钮。重要的是,不要在发布页面之前向 FB 展示该页面,如果这样做,请更改 URL。
When we first put up a blog post, Facebook often (but not always) gets confused about what the page is. Specifically, if you try to use the Like button on the blog page OR if you try to share via the Share link on your profile, Facebook will see the root blog page rather than the actual post page.
For example, we recently posted:
http://thisorthat.com/blog/2010-song-of-the-year-round-1-results
If the user "likes" it, it returns the title for:
"http://thisorthat.com/blog"
When you run the post URL through the FB Linter, you can see the problem.
"http://developers.facebook.com/tools/linter?url=http://thisorthat.com/blog/2010-song-of-the-year-round-1-results"
In the Debug section it shows an extra og:title, og:url, description and og:image (the last 4 rows of the Debug section). This is the meta data from the root directory. What we cannot figure out is why. Why is Facebook seeing the correct meta data on the page and then also pulling the meta data from the root directory (and using that incorrectly to populate the data for the Like button and the Share URL tool)?
One other oddity. FB "figures it out" after a few days. Of course, by that time relatively few people are viewing the post.
UPDATE -- I want to thank Peter Bailey again for his answer, but we also discovered that there was another issue that we had to resolve before the Like button worked.
The issue was that we were displaying the Facebook the Like button on a post that was not yet published. The problem with this is that FB then can't resolve the URL and "guesses" as to the correct URL. In our case, it always guesses thisorthat.com/blog. Unfortunately, it then caches that guess for a number of days and that cache cannot be cleared by the Linter. So the ultimate solution was to both fix the og:type as Peter suggested, but also to remove the Like button from the blog post preview. It's very important that you don't show FB a page before it's published or if you do, change the URL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很确定问题出在您的开放图谱类型上。
根据文档
Pretty sure it's your Open Graph type that's the problem.
Per the documentation