我已经定义了发布者 Organization在 WebSite在主页上定义的节点,我现在想从其他页面上的文章链接到该发布者。但是,我也想链接到 WebSite以及,他们自然共享相同的 @id如果我遵循使用 URL 作为 @id 的建议.

{ 
    "@context": "http://schema.org", 
    "@type": "WebSite", 
    "@id": "http://www.example.com/", 
    "url": "http://www.example.com/", 
    ... 
    "publisher": { 
        "@type": "Organization", 
        "@id": "http://www.example.com/",  <-- duplicated 
        "url": "http://www.example.com/" 
    } 
} 

{ 
    "@context": "http://schema.org", 
    "@type": "WebPage", 
    "@id": "http://www.example.com/news", 
    "url": "http://www.example.com/news", 
    "isPartOf": { 
        "@id": "http://www.example.com/"  <-- site or publisher? 
    } 
    ... 
    "publisher": { 
        "@id": "http://www.example.com/"  <-- site or publisher? 
    } 
} 

我假设每个节点的 ID 必须是唯一的,那么是否有统一 ID 的最佳实践,例如添加哈希?

{ 
    "@id": "http://www.example.com/#site", 
    ... 
    "publisher": { 
        "@id": "http://www.example.com/#publisher", 
    } 
} 

如果可行,处理器 (Google) 是否会加载 @id找到节点的其余属性?

与此相关的是 url在许多节点类型中发现的属性假定为 @id如果失踪?我最终将页面的完整 URL 复制为 @id和 url对于大多数节点。这是常态吗?

请您参考如下方法:

@id (JSON-LD)

(微数据中的 itemid 和 RDFa 中的 resource 也是如此)

每个事物都应该有一个不同的 URI,如果多个节点是关于同一事物的,那么理想情况下,它们应该重用这个 URI。请注意,这些不一定是 URL,它们通常不应用作 Schema.org 的 url 的值。属性(property)(见下文)。

使用 URI 片段是实现此目的的常见且最简单的方法。有关示例(和其他方式),请参阅我对这些问题的回答:

  • Best practices for adding semantics to a website
  • Concepts for RDFa DRY references
  • RDF 303 redirect clarification
  • Structured Data > Microdata & Json-LD > Entity IDs > Fragment Identifier
  • How to implement “mainEntityOfPage” to this specific site?

  • 对于您的示例案例,组织的网站,根 URL ( http://www.example.com/ ) 通常“代表”三件事:
  • 首页
  • 全站
  • 机构

  • 由于主页是检索到的资源,因此它应该获得 URI http://www.example.com/ .网站和组织应该有自己的碎片;由您来选择,例如: http://www.example.com/#site用于网站,以及 http://www.example.com/#organization对于组织(FWIW, Apple seems to use #organization 也是。)
  • 主页:http://www.example.com/
  • 整个网站:http://www.example.com/#site
  • 该组织:http://www.example.com/#organization

  • (通常只涉及两种不同的事物:文档和文档描述的事物。然后事物经常得到像 #this 这样的片段,如果是人,则是 #i ,但这只是一个约定。)

    If that works, will processors (Google) load the @id to find the rest of the node's properties?



    Google 不会记录他们是否尝试加载这些 URI。

    请注意,不要求这些 URI 实际指向文档。您可以使用提供 404 个答案的 HTTP URI,或者您可以使用不允许检索文档开头的 URI 方案(例如, urn , tag ,...)。
    url (Schema.org)

    Schema.org 的 url 属性应该用于指向可以访问的页面的 URL。它不是提供 ID 的一种方式,因此它不一定与 @id 中提供的 URI 相同.

    在您的示例中,您可能会使用相同的 url所有三件事的值(value):
  • 主页:@id :http://www.example.com/url :http://www.example.com/
  • 整个网站:@id :http://www.example.com/#siteurl :http://www.example.com/
  • 该组织:@id :http://www.example.com/#organizationurl :http://www.example.com/

  • 评论关闭
    IT干货网

    微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!