JSON-LD:如何拥有多个articleSection?

时间:2019-11-29 16:19:31

标签: schema.org json-ld

我的博客文章可以有很多类别。那么如何在articleSection中添加这些类别?

使用itemprop,您可以这样设置:

<span itemprop="articleSection">Sports</span> -
<span itemprop="articleSection">Politics</span> -
<span itemprop="articleSection">US News</span>

如何使用JSON-LD?

1 个答案:

答案 0 :(得分:0)

您可以将其作为数组:

"articleSection": [
    "Category 1",
    "Category 2"
]

这是BlogPosting中的完整示例,将在Google Structured Data tool上进行验证:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "BlogPosting",
  "name": "Apple announces iPhone SE",
  "headline": "Apple phone headline",
  "author": "John Smith",
  "image": "https://example.com/photos/1x1/photo.jpg",
   "publisher": {
    "@type": "Organization",
    "name": "Google",
    "logo": {
      "@type": "ImageObject",
      "url": "https://google.com/logo.jpg"
    }
  },
  "articleSection": [
    "Category 1",
    "Category 2"
  ],
  "datePublished": "2016-03-21T11:30:00-07:00",
  "description": "New iPhone announced at 11:30 in California."
}
</script>