Why is Facebook returning the wrong page (affects Facebook Like and Share URL)?

核能气质少年 提交于 2020-01-22 19:17:08

问题


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.


回答1:


Pretty sure it's your Open Graph type that's the problem.

<meta content="website" property="og:type"/>

Per the documentation

Use article for any URL that represents transient content - such as a news article, blog post, photo, video, etc. Do not use website for this purpose. website and blog are designed to represent an entire site, an og:type tag with types website or blog should usually only appear on the root of a domain.



来源:https://stackoverflow.com/questions/4738616/why-is-facebook-returning-the-wrong-page-affects-facebook-like-and-share-url

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