开放图谱元标签

5

我使用Facebook应用程序(ShortStack)制作我的页面。 当我使用短链接分享时,我想个性化发布内容。 我尝试创建开放图谱元标记,但它不起作用。

1个回答

6
您需要在页面中添加opengraph元标签,例如:
<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."/>

在这里找到示例http://developers.facebook.com/docs/opengraphprotocol/

您还需要将顶部标签更改为

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:og="http://ogp.me/ns#"
  xmlns:fb="http://www.facebook.com/2008/fbml">

然后它应该可以正常工作 :)

为了调试您的页面并查看是否正确实现了OpenGraph标签,请使用此处的调试器工具:http://developers.facebook.com/tools/debug/

希望这有所帮助。


为了进行简单的测试,您可以将HTML片段粘贴到此工具http://www.golery.com/posthtml中并在线发布,然后使用Facebook调试器developers.facebook.com/tools/debug进行尝试。请注意,Facebook会缓存图像,因此您需要多次请求Facebook调试器以刷新。 - greensuisse

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接