3

显然,Facebook Share 不会获取页面加载后(通过 JavaScript)更改的标题/描述元标记。它基本上使用加载时可用的元标记。

这是一个简单的例子

  • 单击该链接将更改标题/描述元标记。您可以使用 Firebug 确认。
  • 单击 f|Share 按钮:Facebook 仍然始终显示“页面加载时可用的标题”。和“页面加载时可用的描述”。

有人知道如何解决这个问题吗?

4

4 回答 4

11

This is a quote from Facebook. They scrape the page's meta tags when someone shares that page, and every 24 hours onwards (and not on page-load as you suggested). If you change the meta tags, you need to get FB to "lint" your page again using the URL Linter.

When does Facebook scrape my page?

Facebook needs to scrape your page to know how to display it around the site. Facebook scrapes your page every 24 hours to ensure the properties are up to date. The page is also scraped when an admin for the Open Graph page clicks the Like button and when the URL is entered into the Facebook URL Linter. Facebook observes cache headers on your URLs - it will look at "Expires" and "Cache-Control" in order of preference. However, even if you specify a longer time, Facebook will scrape your page every 24 hours.

Source

于 2011-03-22T09:25:50.733 回答
1

Because the facebook server hits the URL you submit and looks for meta tags. It will always default to the original tags.

于 2010-06-29T14:11:04.277 回答
0

它与 Facebook 无关。他们只是为它提供了一个 api。api 将元标记作为参数。因此,您将元标记设置为 facebook 共享。

于 2010-06-29T14:18:21.800 回答
0

我假设 Facebook 服务器在抓取您的页面时不会执行 javascript。

您可以使用服务器端逻辑来检测 Facebook 用户代理并相应地修改输出的 HTML。

根据此页面底部(http://developers.facebook.com/docs/opengraph/),用户代理当前是:

facebookexternalhit/1.0 
于 2011-09-23T16:00:45.843 回答