我想为我的网站实现面包屑,但我不想在我的页面上为它创建任何可见的标记。我曾想过使用元标记,但由于它们没有href
属性,因此不能包含itemprop="url"
属性。以下是我正在使用的代码:
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<meta href="http://www.example.com/dresses" itemprop="url">
<meta itemprop="title" content="Dresses">
</div>
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<meta href="http://www.example.com/dresses/real" itemprop="url">
<meta itemprop="title" content="Real Dresses">
</div>
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<meta href="http://www.example.com/clothes/dresses/real/green" itemprop="url">
<meta itemprop="title" content="Real Green Dresses">
</div>
有什么变通方法可以实现这一点吗?
HTML5定义了meta
元素
[…]表示不能使用
title
、base
、link
、style
和script
元素来表达的各种元数据。
link
元素"允许作者将文档链接到其他资源"。
因此,如果值是URI,则必须使用link
而不是meta
。(Microdata也明确要求这样做。)
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<link itemprop="url" href="http://www.example.com/dresses">
<meta itemprop="title" content="Dresses">
</div>
根据谷歌服务条款,每个标记都必须对每个用户可见。不要包含任何隐藏的标记,因为谷歌会惩罚你。