Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What is the correct use of schema.org SiteNavigationElement in HTML?
The schema.org SiteNavigationElement extends WebPageElement and is used to mark up navigation links on a webpage. It helps search engines understand your site's navigation structure and can enhance search result displays with sitelinks.
Basic Syntax
The SiteNavigationElement uses microdata attributes to define navigation properties:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="url" itemprop="url">
<span itemprop="name">Link Text</span>
</a>
</nav>
Key Properties
The main properties used with SiteNavigationElement are:
- url - The destination URL of the navigation link
- name - The visible text or name of the navigation item
Complete Example
Here's how to implement SiteNavigationElement for a typical website navigation:
<nav role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a href="/" title="Link to home page" itemprop="url">
<span itemprop="name">Home</span>
</a>
</li>
<li>
<a href="/products" title="Link to products page" itemprop="url">
<span itemprop="name">Products</span>
</a>
</li>
<li>
<a href="/about" title="Link to about page" itemprop="url">
<span itemprop="name">About Us</span>
</a>
</li>
<li>
<a href="/contact" title="Link to contact page" itemprop="url">
<span itemprop="name">Contact</span>
</a>
</li>
</ul>
</nav>
<script>
console.log("Navigation with SiteNavigationElement schema markup implemented");
</script>
Navigation with SiteNavigationElement schema markup implemented
Multiple Navigation Sections
You can use multiple SiteNavigationElement sections for different navigation areas:
<!-- Main Navigation -->
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="/" itemprop="url">
<span itemprop="name">Home</span>
</a>
<a href="/services" itemprop="url">
<span itemprop="name">Services</span>
</a>
</nav>
<!-- Footer Navigation -->
<footer>
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="/privacy" itemprop="url">
<span itemprop="name">Privacy Policy</span>
</a>
<a href="/terms" itemprop="url">
<span itemprop="name">Terms of Service</span>
</a>
</nav>
</footer>
<script>
console.log("Multiple navigation sections with schema markup");
</script>
Multiple navigation sections with schema markup
Benefits
Using SiteNavigationElement provides several advantages:
- SEO Enhancement - Helps search engines understand site structure
- Rich Snippets - May display enhanced sitelinks in search results
- Accessibility - Improves semantic meaning for screen readers
- Crawling Efficiency - Guides search engine crawlers through your site
Best Practices
- Use
SiteNavigationElementonly for main navigation, not every link - Include meaningful, descriptive names in the
nameproperty - Ensure URLs in the
urlproperty are absolute or properly relative - Combine with proper HTML5 semantic elements like
<nav>
Conclusion
SiteNavigationElement is essential for marking up website navigation to help search engines understand your site structure. Use it on main navigation areas with proper url and name properties for optimal SEO benefits.
