1

例子:

转义的文本(在文章正文中):

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "headline": "Article headline",
  "alternativeHeadline": "The headline of the Article",
  "image": ["thumbnail1.jpg", "thumbnail2.jpg"],
  "datePublished": "2015-02-05T08:00:00+08:00",
  "description": "A most wonderful article",
  "articleBody": "\"Hello!\" said Bob.\n\"Hi,\" said Jane, \"Go away.\""
}
</script>

以及使用 URIComponent 编码的相同文本(同样,在 articleBody 中):

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "NewsArticle",
      "headline": "Article headline",
      "alternativeHeadline": "The headline of the Article",
      "image": ["thumbnail1.jpg", "thumbnail2.jpg"],
      "datePublished": "2015-02-05T08:00:00+08:00",
      "description": "A most wonderful article",
      "articleBody": "%22Hello!%22%20said%20Bob.%0A%22Hi%2C%22%20said%20Jane%2C%20%22Go%20away.%22%0A"
    }
    </script>
4

1 回答 1

1

你不能。Google 不会解析编码文本,这会导致编码字符出现在丰富网页摘要/丰富卡片中。

这是一个非常基本的示例——复制下面的代码并将其粘贴到Google 的架构检查器中:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Recipe",
  "name": "Perfect%20Apple%20Pie",
  "image": "http://images.edge-generalmills.com/56459281-6fe6-4d9d-984f-385c9488d824.jpg"
}
</script>

单击“验证”,您将看到一个绿色的“预览”按钮。当您单击预览时,您将看到以下内容:

在此处输入图像描述

于 2016-09-07T00:16:25.997 回答