如何自定义"网页预览"在iMessages中为我的网站?

时间:2017-08-15 21:17:20

标签: html web

在iMessage中,当您共享网页时,URL会扩展为一个很好的预览,如下所示: NYTimes rich preview in iMessage

如何将此元数据添加到我自己的网站?

1 个答案:

答案 0 :(得分:1)

事实证明,您可以通过实施The Open Graph protocol来获得这些预览,如下所示:

<html prefix="og: http://ogp.me/ns#">
<head>
  <title>The Rock (1996)</title>
  <meta property="og:title" content="An Eclipse Chaser’s Guide to Your First Eclipse" />
  <meta property="og:type" content="article" />
  <meta property="og:url" content="https://www.nytimes.com/2017/08/14/science/eclipse-chasers-first.html" />
  <meta property="og:image" content="https://static01.nyt.com/images/2017/08/15/science/15SCI-CHASERS4/15SCI-CHASERS4-facebookJumbo.jpg" />
  ...
</head>
...
</html>