: Is adding SiteNavigationElement properties to child menu items required? I would like to add SiteNavigationElement to my nav. The question is, do I add url and name properties to primary menu
I would like to add SiteNavigationElement to my nav. The question is, do I add url and name properties to primary menu items only or do I also add them to the child nav items as well?
<nav itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="#"><span itemprop="name">Primary Menu Item</span></a>
<div class="child menu">
<ul>
<li>
<a itemprop="url" href="#"><span itemprop="name">Child Menu Item</span></a>
</li>
</ul>
</div>
</li>
</ul>
</nav>
More posts by @Odierno851
2 Comments
Sorted by latest first Latest Oldest Best
The SiteNavigationElement type should be used for menus, not for menu items (details).
So the properties (like name and url) are about the whole navigation, not about single navigation entries.
This would be an appropriate use of SiteNavigationElement:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<h1 itemprop="name">Navigation</h1>
<ul>
<li><a href="/">Home</a></li> <!-- don’t use name/url here! -->
<li><a href="/about">About</a></li> <!-- don’t use name/url here! -->
</ul>
</nav>
It might makes sense to provide it in certain special cases, or in non-HTML documents, but in the typical case of a HTML webpage, it’s rather pointless to provide it.
(This goes for WebPageElement and all its other sub-types, too. From time to time it gets discussed to deprecate them.)
Parents should always have siblings, but you can use as few as you like, or as many as you like. Since your using SiteNavigationElement, you can use any of the childs from:
Properties from CreativeWork
Properties from Thing
Using with or without itemprop="name" are both valid.
Valid:
<nav itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="#"><span itemprop="name">Primary Menu Item</span></a>
<div class="child menu">
<ul>
<li><a itemprop="url" href="#"><span itemprop="name">Child Menu Item</span></a></li>
</ul>
</div>
</li>
</ul>
</nav>
Valid:
<nav itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="#">Primary Menu Item</a>
<div class="child menu">
<ul>
<li><a itemprop="url" href="#">Child Menu Item</a></li>
</ul>
</div>
</li>
</ul>
</nav>
Pointless:
<nav itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a href="#">Primary Menu Item</a>
<div class="child menu">
<ul>
<li><a href="#">Child Menu Item</a></li>
</ul>
</div>
</li>
</ul>
</nav>
Personally I only use schema on things I want Google and other search engines to understand, simply using Schema on everything, well for at least my opionion is just away of unnecessary bloating your code, its not like Google and other engines will reward for it, or not understand if you don't.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.