在 schema.org 中定义子节点之前的父节点 [英] Define parent node before child in schema.org

查看:50
本文介绍了在 schema.org 中定义子节点之前的父节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否必须在 schema.org 的 DOM 模式中的 Offer 节点(子)之前编写 Product 节点(父)或者我可以定义 Offer没有父节点的节点?

解决方案

Schema.org 从不要求存在父"项(除非您在带有 itemscope<的元素上使用 itemprop/code>).

所以这完全没问题:

</html>

但即使您想添加产品,它也不必成为 Offer 的父级.

您可以在优惠下嵌套产品:

<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Product"></div>

或者您可以将两者放在同一级别并使用 itemref:

<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Product" id="foo">

Is it obligatory to write Product node (parent) before Offer node (child) in DOM schema of schema.org or I can define Offer node without its parent node?

解决方案

Schema.org never requires the existence of "parent" items (unless you use itemprop on an element with itemscope).

So this is totally fine:

<html itemscope itemtype="http://schema.org/Offer">
</html>

But even if you would want to add a Product, it doesn’t have to be a parent for Offer.

You can nest the Product under Offer:

<div itemscope itemtype="http://schema.org/Offer">
  <div itemprop="itemOffered" itemscope itemtype="http://schema.org/Product"></div>
</div>

Or you can have both on the same level and use itemref:

<div itemscope itemtype="http://schema.org/Offer" itemref="foo">
</div>

<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Product" id="foo">
</div>

这篇关于在 schema.org 中定义子节点之前的父节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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