What is the correct use of schema.org SiteNavigationElement?

后端 未结 10 1803
既然无缘
既然无缘 2020-11-30 02:27

In SEO terms...

Is it best to put the scheme on the parent containing all the links?

相关标签:
10条回答
  • 2020-11-30 03:02

    According to Search Engine Land, it's supposed to look like this:

    <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>
    
    0 讨论(0)
  • 2020-11-30 03:10
    <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>
    
    0 讨论(0)
  • 2020-11-30 03:10

    Having considered all the above, I came to the following conclusion:

    <nav itemscope itemtype="http://schema.org/SiteNavigationElement">
      <ul>
       <li itemprop="hasPart">
         <a href="/" itemprop="url"><span itemprop="name">Home</span></a>
       </li>
    </nav>

    Thus, each <li> is part of the SiteNavigationElement that has the url and name. I think this is the best option.

    But do search engines need such redundant markup? They already know that href in <a href=""> is the url, and inside the tag <a>name</a> is the name. What do you think about it?

    0 讨论(0)
  • 2020-11-30 03:11

    schema.org/SiteNavigationElement extends WebPageElement and can be used to mark-up links, which would often make good contextual links. You can use this schema for your page menu.

    <nav role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">
    <ul>
        <li>
            <a href="https://yoursite.com/" title="Link to Home" itemprop="url">
                <span itemprop="name">Home</span>
            </a>
        </li>
        <li>
            <a href="https://yoursite.com/sample-page" title="Link to sample page" itemprop="url">
                <span itemprop="name">sample page</span>
            </a>
        </li>
    </ul>
    

    0 讨论(0)
提交回复
热议问题