If SiteNavigationElement
is meant for the whole navigation (i.e., a navigation link list), your first example is correct.
If SiteNavigationElement
is meant for a single navigation entry (i.e., a link in the navigation link list), your second example is correct.
I think Schema.org doesn’t unambiguously define which variant is meant, as they only say:
A navigation element of the page.
However, the parent type WebPageElement
is defined as:
A web page element, like a table or an image
Also, all the other child types (like Table
or WPFooter
) seem to be used for the whole thing, and not specific parts of the thing.
So this seems to suggest that the whole navigation should be marked up, and not each single link:
<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>
In this case, all the properties belong to the whole navigation, so that means the url
property would specify a URL for this navigation (and not the URLs of the links in this navigation!).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…