Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
743 views
in Technique[技术] by (71.8m points)

navigation - schema.org: SiteNavigationElement with multiple elements

I am trying to implement schema.org microdata for my menu navigation. This navigation will look similar to this:

<ul>
    <li><a href="#"><span>Name1</span></a></li>
    <li><a href="#"><span>Name2</span></a></li>
    <li><a href="#"><span>Name3</span></a></li>
</ul>

I want to make use of SiteNavigationElement, unfortunately all I could find where examples with no clear answer of how to make use of multiple elements.

Does anybody know for sure, how to use SiteNavigationElement on multiple elements?

UPDATE:

This is my original menu structure I came up with after reading all answers in the duplicate link:

<nav class="menu" itemscope itemtype="http://schema.org/SiteNavigationElement">
    <ul class="main-menu" role="menubar">
        <li class="main-menu">Home</li>
        <li class="parent">
            <ul class="sub-menu">
                <li><a itemprop="url" role="menuitem" href="index.php"><span itemprop="name">Home</span></a></li>
                <li><a itemprop="url" role="menuitem" href="tricks.php"><span itemprop="name">Tricks</span></a></li>
                <li><a itemprop="url" role="menuitem" href="features.php"><span itemprop="name">Features</span></a></li>
            </ul>
        </li>
    </ul>
 </nav>

Now, everything has been fully indexed by google and I am able to see it in Google Webmaster Tools.

So how does Google Webmaster Tools see it?

Page URL   | Items | Items with errors | Last detected |    Name    | Errors
----------------------------------------------------------------------------
Page1.php  |   1   |          -        |     2/11/16   |  Features  |    -
Page2.php  |   1   |          -        |     2/11/16   |  Features  |    -
Page3.php  |   1   |          -        |     2/11/16   |  Features  |    -
Page4.php  |   1   |          -        |     2/11/16   |  Features  |    -
...

All my pages which have been indexed and have the menu (Page1.php - Page4.php), each only have 1 item. And the detected item is always only the last link specified in SiteNavigationElement.

So there must be an error obviously.

  • Why is google only seeing one link?
  • And why is it always the last link?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is my original menu structure I came up with after reading all answers in the duplicate link

Except my answer, it seems ;-) As I explained in my answer to the possibly duplicate question, the url property should not be used for each navigation link. Instead, the url property should provide a URL for the whole navigation (which, typically, doesn’t exist).

The same goes for every other SiteNavigationElement property (as of Schema.org version 2.2), like name in your example: it’s for the name of the navigation (e.g., "Navigation"), not for the names of the navigation entries.

So using the SiteNavigationElement does not seem to be very useful. The same is the case with WebPageElement and its other sub-types. They may be useful in special cases and in non-HTML contexts, but generally I wouldn’t use them for typical Web pages.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...