Schema.org 中的指针究竟是什么以及如何将它们与 JSON-LD 一起使用? [英] What exactly are pointers in Schema.org and how to use them with JSON-LD?

查看:38
本文介绍了Schema.org 中的指针究竟是什么以及如何将它们与 JSON-LD 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

schema.org 文档有时会提到指针".例如.Product 架构 具有属性 isSimilarTo.

The schema.org docs refer sometimes to "pointers". E.g. Product schema has the property isSimilarTo.

我明白,我可以直接使用 ProductService.例如:

I do understand, that I could use a Productor a Service directly. E.g.:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Product",
  "name": "BMW",
  "isSimilarTo": {
    "@type": "Product",
    "name": "Mercedes Benz"
  },
  "offers": {
    "@type": "Offer",
    "priceCurrency": "EUR",
    "price": "100000.00"
  }
}
</script>

这是在此上下文中使用和解释术语指针"的唯一且正确的方法吗?对于指针,我宁愿期望一些值(ID 或 URL 或类似的)只是指向另一个产品或服务.

Is this the only and the correct way using and interpreting the term 'pointer' in this context? For a pointer, I would rather expect some value (an ID or an URL or similar) just pointing to another product or service.

推荐答案

您的示例是正确的,它遵循 Schema.org 对 isSimilarTo 属性.但是 Schema.org 允许每个属性的 URI 值,即使对于那些没有明确列出 URL 作为预期值的属性.

Your example is correct, and it follows Schema.org’s recommendation for the expected value of the isSimilarTo property. But Schema.org allows URI values for each property, even for those that don’t explicitly list URL as expected value.

所以你也可以使用:

  "isSimilarTo": {
    "@id": "https://example.com/products/mercedes-benz#this"
  },

请注意,消费者(如 Google)不一定会遵循这些参考资料.您也可以同时使用这两种方式:在当前页面上提供数据(或部分数据),并引用项目的 URI:

Note that consumers (like Google) don’t necessarily follow these references. You could also use both ways: provide the data (or some of it) on the current page, and refer to the item’s URI:

   "isSimilarTo": {
    "@id": "https://example.com/products/mercedes-benz#this",
    "@type": "Product",
    "name": "Mercedes Benz",
    "url": "https://example.com/products/mercedes-benz"
  },

这篇关于Schema.org 中的指针究竟是什么以及如何将它们与 JSON-LD 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆