【发布时间】:2018-06-09 09:17:39
【问题描述】:
因为我在任何地方都找不到合适的 RDFa 示例,所以我想在这里问一个问题。在Google's page 上有面包屑的示例,使用微数据或 RDFa 标记。当您单击“示例 2”旁边的“RDFa”下的“查看标记”时,您会看到这种特定类型面包屑的标记示例(据我所知,面包屑中的图像是可选的,所以我摆脱了他们):
<ol vocab="http://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com/books">
<span property="name">Books</span>
</a>
<meta property="position" content="1">
</li>
›
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com/books/sciencefiction">
<span property="name">Science Fiction</span>
</a>
<meta property="position" content="2">
</li>
›
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com/books/sciencefiction/awardwinnders">
<span property="name">Award Winners</span>
</a>
<meta property="position" content="3">
</li>
</ol>
不幸的是,它没有说明主页和当前页面的面包屑,所以我不知道如何构建它。
更准确地说,我的问题是什么property 和typeof 属性用于主页和当前页面?我是否应该只使用上面示例中的第一个链接作为主页而不更改标记中的任何内容,而当前页面只省略链接,因为它并不是真正需要的,所以它看起来像这样?:
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com">
<span property="name">Home Page</span>
</a>
<meta property="position" content="1">
</li>
// Above is for Home, below is for Current. I omitted items 2 and 3 which are positioned somwhere in between..
<li property="itemListElement" typeof="ListItem">
<span property="name">Current Page</span>
<meta property="position" content="4">
</li>
【问题讨论】:
-
为什么要对首页和当前页进行特殊处理?为什么不像“书籍”、“科幻小说”等一样添加它们?
-
@unor 至于当前页面我真的不需要它的链接,这就是为什么我没有用链接包装它,但是可以这样做吗?我不确定主页;在上面的示例中,我将其完全视为“书籍”、“科幻小说”等,但这是一条正确的路吗?
标签: html schema.org breadcrumbs google-rich-snippets rdfa