Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

According to 'http://schema.org/docs/full.html'

Article, WebPage, WebPageElement are in the same level.

WPSideBar is child of WebPageElement.

Now, should I add child under parent or is this code is correct?

<div itemscope itemtype="http://schema.org/WPSideBar">

    <div itemscope itemtype="http://schema.org/Article">
    </div>

    <div itemscope itemtype="http://schema.org/Article">
    </div>

    <div itemscope itemtype="http://schema.org/Article">
    </div>

<div>
share|improve this question
    
"Should I add child under parent": Could you give an example how that would look like? –  unor Mar 10 at 20:14
    
at current example...WPSideBar is child of WebPageElement ...right?WebPageElement and Article are in same level...Now is it possible child of WebPageElement be parent of Article? –  user2726957 Mar 10 at 21:34

2 Answers 2

up vote 1 down vote accepted

Your code is fine.

The hierarchy doesn’t matter in that sense (it has other purposes). You can use whichever types you want (you should respect Schema.org’s expected types, though).

A simple example: A MedicalScholarlyArticle (which is a type pretty deep in the hierarchy: Thing > CreativeWork > Article > ScholarlyArticle > MedicalScholarlyArticle) can reference (i.e., include as child) a Thing (which is the super type of everything):

<div itemscope itemtype="http://schema.org/MedicalScholarlyArticle">
  <span itemprop="about" itemscope itemtype="http://schema.org/Thing">The whole universe.</span>
</div>

However, note that in your specific example, the "children" items are not related to the parent item. They only happen to be nested under this item, but there is no property that connects them. So Microdata parsers won’t recognize that there is a parent/children relation, it’s "flat" for them:

WPSideBar
Article
Article
Article

If you’d use a property (for example about), parsers would recognize the relationship:

WPSideBar
    about Article
    about Article
    about Article
share|improve this answer
    
I think that having about Article underneath/nested on a WPSideBar would be incorrect since that implies that the sidebar is about each article's subject, which is not the case. It's true that the relation between elements that are not direct descendants of each other may be or seem "flat" or unlinked. I'd link them using additionalType and ItemList, but then you have the problem of non valid HTML (at least I don't know a way to use it and have valid HTML). What's your perspective on this? –  PatomaS Mar 12 at 6:17
    
Thank you @unor, your last Note you said me is better to use a property...In my structure I use 'text',But You use 'about'...which one is better? –  user2726957 Mar 12 at 14:05
    
@PatomaS: I don’t feel strongly about using the about property here (though, next to mentions and citation, it’s the only property that allows referencing a Article). --- What do you think would be appropriate as content for about in a WPSideBar then? –  unor Mar 13 at 17:33
    
@PatomaS: Regarding additionalType and ItemList: I’m not sure I understand what you mean (maybe this would make a good separate question?). I’d say you would get invalid Microdata by using properties from ItemList that way. –  unor Mar 13 at 17:36
    
@user2726957: The text property seems to be a better choice than about, yes, but it expects Text as value, not a different item (Article in your case). You’d have to decide if or if not you want to "break" with Schema.org’s recommendation re. expected types here. –  unor Mar 13 at 17:38

You can add parent elements, from the tree perspective inside child elements.

So, for instance your example is valid, of course it need some more items, but it would be OK. I did a little test with the next code and it's recognised properly

<div itemscope itemtype="http://schema.org/WPSideBar">
    <meta itemprop="name" content="lateral_section" />
    <div itemscope itemtype="http://schema.org/Article">
        <p itemprop="name">title of article</p>
        by <p itemprop="author">author name</p>
    </div>
    <div itemscope itemtype="http://schema.org/Article">
        <p itemprop="name">title of article</p>
        by <p itemprop="author">author name</p>
    </div>
    <div itemscope itemtype="http://schema.org/Article">
        <p itemprop="name">title of article</p>
        by <p itemprop="author">author name</p>
    </div>
<div>
share|improve this answer
    
Thank you for your answer:) –  user2726957 Mar 12 at 14:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.