相关疑难解决方法(0)

Schema.org JSON-LD参考

我有一个关于在另一个JSON-LD schema.org标记中引用JSON-LD schema.org标记的问题.我有一个主要事件的页面位于,http://event.com/这里是JSON-LD标记.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "MainEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

主事件有多个子事件,例如http://event.com/sub-event-1/,这里是JSON-LD标记:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

我要做的是将子事件标记为主事件的一部分.是否可以创建从主事件到子事件的引用?像这样的东西:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
  superEvent {
    "url": "http://event.com/"
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

如果可能,什么是正确的标记供参考.我找不到任何有关它的信息.

或者是否需要在每个SubEvent中嵌入MainEvent,如下所示:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": { …
Run Code Online (Sandbox Code Playgroud)

schema.org json-ld

8
推荐指数
2
解决办法
6352
查看次数

混合 JSON-LD CollectionPage 和 Schema.org 的微数据 `hasPart`

下面的微数据标记效果很好,谷歌的结构化数据测试工具显示了一个CollectionPageWebSite/WebPage作为孩子。

<body itemscope itemtype="https://schema.org/CollectionPage">
  <span itemscope itemtype="https://schema.org/WebSite" itemprop="hasPart">
    <a href="https://springfield-xxxx.us" itemprop="url">Official site of Springfield</a>
  </span>
  <span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
    <a href="https://facebook.com/group/XXXX" itemprop="url">Local events in Springfield</a>
  </span>
  <span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
    <a href="https://news.us/city/springfield-xxxx" itemprop="url">Latest news in Springfield</a>
  </span>
</body>
Run Code Online (Sandbox Code Playgroud)

但是,当我添加 JSON-LD 时,Google 的结构化数据测试工具会分别显示对象CollectionPageWebPage/WebSite就像它们没有连接一样。这是一个带有 JSON-LD 的示例:

<!DOCTYPE html>
<html>
<head>
  <script type="application/ld+json">
    {
      "description": "...",
      "author": {"@type":"Person", "name": "Homer J. Simpson"},
      "@type": "CollectionPage",
      "url": "http://my-springfield.us/sites",
      "publisher": {
        "@type": "Organization",
        "logo": …
Run Code Online (Sandbox Code Playgroud)

microdata schema.org json-ld

5
推荐指数
1
解决办法
2223
查看次数

标签 统计

json-ld ×2

schema.org ×2

microdata ×1