Gie*_*ers 38 seo html5 schema.org
在SEO方面......
是否最好将该方案放在包含所有链接的父级上?
<nav itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</nav>
Run Code Online (Sandbox Code Playgroud)
......或者每个链接应该被视为它自己的元素吗?
<nav>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 1</span>
</a>
</span>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 2</span>
</a>
</span>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 3</span>
</a>
</span>
</nav>
Run Code Online (Sandbox Code Playgroud)
uno*_*nor 23
如果SiteNavigationElement用于整个导航(即导航链接列表),您的第一个示例是正确的.
如果SiteNavigationElement用于单个导航条目(即导航链接列表中的链接),则第二个示例是正确的.
我认为Schema.org没有明确定义哪个变体意味着什么,因为他们只说:
页面的导航元素.
但是,父类型WebPageElement定义为:
网页元素,如表格或图像
此外,所有其他子类型(如Table或WPFooter)似乎都用于整个事物,而不是事物的特定部分.
所以这似乎表明应该标记整个导航,而不是每个单独的链接:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li><a href="/link-1">Link 1</a></li> <!-- don’t use the 'url' or 'name' property here! -->
<li><a href="/link-2">Link 2</a></li>
</ul>
</nav>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,所有属性都属于整个导航,因此这意味着该url属性将指定此导航的URL(而不是此导航中链接的URL!).
Joh*_*rry 13
根据Search Engine Land,它应该看起来像这样:
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name">
<a itemprop="url" href="#">Link 1</a>
</li>
<li itemprop="name">
<a itemprop="url" href="#">Link 2</a>
</li>
<li itemprop="name">
<a itemprop="url" href="#">Travel Resources</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
第一个答案是正确的,但我将两者混合为(HTML5-)语义:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="http://example.com/">
<span itemprop="name">Link 1</span>
</a>
</li>
</ul>
</nav>
Run Code Online (Sandbox Code Playgroud)
<nav role="navigation">
<ul role="menubar" aria-activedescendant="">
<li role="presentation" itemscope itemtype="https://schema.org/SiteNavigationElement">
<a href="" role="menuitem" tabindex="-1" itemprop="url">
<span itemprop="name">Link 1</span>
</a>
</li>
</ul>
</nav>
Run Code Online (Sandbox Code Playgroud)