在Article结构数据类型中实现多个图像

问题描述

例如,有一篇新闻图片包含3张图片。第一个-主图片,另外两个-来自社交网络的照片。

我想要:1)将第一张图片定义为主图像。这个搜索引擎应该使用丰富的结果。 2)定义与新闻主题相关的其他2张图片

#1所有图像都转到Article.image属性

<html>
  <head>
    <title>Article headline</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org","@type": "NewsArticle","headline": "Article headline","image": [
        "https://example.com/photos/photo1x1.jpg","https://example.com/photos/photo4x3.jpg","https://example.com/photos/photo16x9.jpg","https://example.com/photos/2.jpg","https://example.com/photos/3.jpg"
       ],"datePublished": "2015-02-05T08:00:00+08:00","dateModified": "2015-02-05T09:20:00+08:00"
    }
    </script>
  </head>
  <body>
  </body>
</html>

#2只有第一个图像转到Article.image属性,其他两个图像到Article.hasPart。

<html>
  <head>
    <title>Article headline</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org","https://example.com/photos/photo16x9.jpg"
       ],"dateModified": "2015-02-05T09:20:00+08:00","hasPart": [
      {
        "@type": "ImageObject","url": "https://example.com/photos/2.jpg"
      },{
        "@type": "ImageObject","url": "https://example.com/photos/3.jpg"
      }
      ]
    }
    </script>
  </head>
  <body>
  </body>
</html>

哪个更正确?

解决方法

  1. 将其他2张图片定义为与新闻主题相关。

结构化数据高度依赖于链接网页的内容。如果我们假设您的网页具有适合三张图片的结构,则在这种情况下,使用属性 about subjectOf 帮你。嵌入最适合该子主题的类型。并为此类型设置单独的图像属性。这样可以创建出丰富的结果,以呈现整篇文章主题的图像和同一篇文章的子主题的图像。但是,结构化数据取决于细节。