Gmail无法识别JSON-LD

时间:2015-03-06 22:58:17

标签: schema.org google-schemas json-ld

我正在尝试测试Gmail在HTML邮件中处理嵌入式JSON-LD的功能,以便在收件箱视图中显示相关操作,其中介绍了here。我已向自己发送了一条消息(使用Python API),我希望Gmail能够呈现我的“查看操作”,其中的一个示例显示为here。然而,一切都没有发生。我期待看到“查看文件”的链接,类似于为航班预订显示的链接等。

我正在尝试了解我的特定JSON-LD内容是否存在问题,或者我是否尝试执行不受支持的操作。嵌入在<body>中的相关JSON-LD段是:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "CreativeWork",
  "@id": "http://my-site.com/file/1",
  "additionalType": "http://www.productontology.org/id/Computer_file",
  "name": "My File",
  "description": "View this file",
  "url": "http://my-site.com/file/1",
  "action": {
    "@type": "ViewAction",
    "url": "http://my-site.com/file/1",
    "name": "View File"
  }
}
</script>

如果电子邮件的编码方式存在问题,请使用原始格式(个人信息编辑)

Received: from 874510238733-ktbae5ftk223du75th86q0uua7i7rp5v.apps.googleusercontent.com
    named unknown
    by gmailapi.google.com
    with HTTPREST;
    Fri, 6 Mar 2015 14:54:52 -0800
Content-Type: multipart/alternative;
 boundary="===============5111695568485418487=="
MIME-Version: 1.0
to: ****@gmail.com
subject: A file has been shared to your email
Date: Fri, 6 Mar 2015 14:54:52 -0800
Message-Id: <CADTCK+Vyd-bKWBJXMcs8eS1zQ-b34BanFzNKOBMVf_2dBiPB3A@mail.gmail.com>
From: ****@gmail.com

--===============5111695568485418487==
Content-Type: text/text; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit


A new file is available.  View this file <http://my-site.com/file/1>

--===============5111695568485418487==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

<html>
<body>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "CreativeWork",
  "@id": "http://my-site.com/file/1",
  "additionalType": "http://www.productontology.org/id/Computer_file",
  "name": "My File",
  "description": "View this file",
  "url": "http://my-site.com/file/1",
  "action": {
    "@type": "ViewAction",
    "url": "http://my-site.com/file/1",
    "name": "View File"
  }
}
</script>

<div>A new file is available.  <a href="http://my-site.com/file/1" target="_blank">View this file</a></div>

</body>
</html>

--===============5111695568485418487==--

0 个答案:

没有答案