2017-10-12 105 views
1

我在我的下面搜索引擎友好的導航工作:使用SiteNavigationElement和BreadcrumbList一起

<nav itemprop="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"> 
    <ul id="hornavmenu" class="nav navbar-nav"> 
     <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" > 
      <a href="index.html" class="fa-home active" itemprop="item"><span itemprop="name">Start</span></a> 
     </li> 
     <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" > 
      <a href="about.html" class="fa-group " itemprop="item"><span itemprop="name">About</span></a> 
     </li> 
     <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" > 
      <a href="contact.html" class="fa-comment " itemprop="item"><span itemprop="name">Contact</span></a> 
     </li> 
    </ul> 
</nav> 

所以問題是,在谷歌搜索Breadcrumblist看起來是這樣的:
URL - >開始 - >關於 - >聯繫

當然,這是錯的,但什麼是錯誤的代碼?另外,我想補充:

<nav itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement"> 
    … 
</nav> 

...但我在哪裏添加BreadcrumbList,如何合併這兩個?

+0

對於不是麪包屑列表的東西,您正在使用'BreadcrumbList',並想知道Google爲何將其顯示爲麪包屑列表? - 爲什麼你使用'BreadcrumbList'? – unor

+0

是的,我想。所以我希望用SiteNavigationElement改變BreadcrumbList – kellerprogger

回答

2

谷歌不鼓勵在麪包屑列表中的「家」鏈接的包含,谷歌的網頁Breadcrumbs所有示例省略一個原點上,如圖所示。麪包屑不用於主導航,你應該有足夠的鏈接到其他地方的根。

在我的使用經驗BreadcrumbList,谷歌沒有省略在SERP中從麪包屑的「家」鏈接時,鏈接指向的域。在這種情況下,您使用的'index.html'可能與'example.com'不同。

SiteNavigationElement用於指示該站點的主導航。如上所述,麪包屑不是這個。使用SiteNavigationElement來實際導航。有關更多詳細信息,請參閱What is the correct use of schema.org SiteNavigationElement?

0

BreadcrumbList類型是breadcrumbs。不要將它用於別的東西。

你的情況,這似乎是一個導航菜單。 SiteNavigationElement類型可用於這些。它可能看起來像:

<nav itemscope itemtype="http://schema.org/SiteNavigationElement"> 
    <ul> 
    <li><a href="index.html">Start</a></li> 
    <li><a href="about.html">About</a></li> 
    <li><a href="contact.html">Contact</a></li> 
    </ul> 
</nav> 

正如你所看到的,它是爲整個導航,而不是單個導航鏈接。所以don’t use name or url for the links

如果要提供關於每個鏈接頁面的結構化數據,可以使用ItemList together with SiteNavigationElement。這與您的示例BreadcrumbList類似。


NB:I recommend not to use SiteNavigationElement at all,除非你心裏有一個具體的使用情況或消費者(在這種情況下,你應該按照自己的文檔)。