1

我想按这样的顺序对我的网站进行编码,所以如果有人将我的网站的 URL 粘贴到他们的 Facebook 状态更新或他们的个人资料页面中,这篇文章将正确显示,旁边有一张图片,从网站解析的文本。

例如,我发布了一个截图。左边的是我的网站。右边的是一些随机的网站。看到他们包含了一张图片,一个文本段落,一个标题等等......

在此处输入图像描述

是否有任何我应该遵循的特殊准则或规则,或者它超出了我的能力范围。另外,我什至可以想到一个用于谷歌搜索的搜索词,所以我把它贴在这里(甚至不知道在 FB apis 上搜索什么)。

谢谢你们!

4

1 回答 1

4

查看 Facebook 文档。您需要在<head> https://developers.facebook.com/docs/opengraphprotocol/中包含 Open Graph 标签

从文档:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
  <title>The Rock (1996)</title>
     <!-- the bold title on Facebook -->
  <meta property="og:title" content="The Rock"/>
  <meta property="og:type" content="movie"/>
     <!-- the url under the title on Facebook -->
  <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
     <!-- the image to the left of text on Facebook -->
  <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"/>
     <!-- the description under description and title on Facebook -->
  <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."/>
  ...
</head>
于 2012-09-21T16:55:42.253 回答