具有多个页面上的属性的微数据标记 [英] Microdata markup with properties on multiple pages

查看:35
本文介绍了具有多个页面上的属性的微数据标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网页,目前我正在向代码中添加微数据标记.我正在使用 schema.org 的 MusicGroup.

我有一个 index.html 页面,我想从中获取此乐队的名称和图像属性:

...<a href="index.php"><img itemprop="image" src="img/logo.png" alt="logo"/></a><p>我们是<span itemprop="name">乐队的名字</span>.</p>...

但是在 about_us.html 页面上有一个简短的描述,我也想使用:

...<p itemprop="description">乐队的描述.</p>...

当我使用这样的代码时,搜索引擎(可以理解)将它们视为两个不同的 MusicGroup:

音乐组 1:
图片:.../img/logo.png
名称:乐队名称

音乐组 2:
描述:乐队的描述.

如何将这些属性链接到一个项目中?

解决方案

微数据的名称-值对是每个网页,而不是每个网站.

因此,在有关音乐组的网站上,可以预期每个页面都包含一个自己的"MusicGroup 项目,但是,实际上总是关于同一个音乐组.但从 Microdata 或 schema.org 的角度来看,这些不同的项目在语义上不会以这种方式连接(不过,消费者可能会猜测到这一点,例如通过比较属性值).

Microdata 的 itemid 属性 可用于唯一标识每个项目.但是要求使用的词汇表支持项目的全局标识符"(itemid 用于 schema.org 上的某些类型(例如,在 MedicalScholarlyArticle),但我不清楚它是否真的支持,如微数据对其他类型的要求,比如 MusicGroup).

所以在你的情况下,你可以:

  • 保持原样
  • 复制信息,以便每个项目都包含所有相关内容(可能使用meta/<代码>链接元素)
  • 在一页上移动所有信息(可能是使用itemref)
  • (如果它应该被允许在 schema.org 中普遍使用)使用 itemid 来声明几个项目实际上是相同的东西

I'm creating a web page and currently I'm adding Microdata markup to the code. I’m using schema.org’s MusicGroup.

I have an index.html page from where I'd like to take the name and the image properties for this band:

<div class="container" itemscope itemtype="http://schema.org/MusicGroup">
    ...
    <a href="index.php"><img itemprop="image" src="img/logo.png" alt="logo" /></a>
    <p>We are <span itemprop="name">NAME OF THE BAND</span>.</p>
    ...
</div>

However on the about_us.html page there is a short description which I'd also like to use:

<div class="container" itemscope itemtype="http://schema.org/MusicGroup">
    ...
    <p itemprop="description">A description of the band.</p>
    ...
</div>

When I use the code like this, search enginges (understandably) treat them as two different MusicGroups:

MusicGroup 1:
Image: .../img/logo.png
Name: NAME OF THE BAND

MusicGroup 2:
Description: A description of the band.

How can I link these properties into one item?

解决方案

Microdata’s name-value pairs are per webpage, not per website.

So on a website about a music group, it can be expected that each page contains an "own" MusicGroup item, which is, however, actually always about the same music group. But from the Microdata or schema.org perspective, these different items would not be semantically connected that way (consumers might guess this however, e.g. by comparing property values).

Microdata’s itemid attribute could be used to uniquely identify each item. But it is required that the used vocabulary supports "global identifiers for items" (itemid is used for some types on schema.org (e.g., in the example for MedicalScholarlyArticle), but it’s not clear to me if it’s really supported as required by Microdata for other types, like MusicGroup).

So in your case, you could:

  • leave it as it is
  • duplicate the information, so that each item has all relevant content (possibly using meta/link elements)
  • move all information on one page (possibly using itemref)
  • (if it should be allowed for general use with schema.org) use itemid to state that several items are actually about the same thing

这篇关于具有多个页面上的属性的微数据标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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