Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

microdata schema.org: how to mix together schemas?

hello I have a page ( http://schema.org/WebPage ) that contains a review ( http://schema.org/Review )

the question are:

  • how to deal with duplicate contents?
  • is correct making elements belong to two or more scopes?
  • how to do this, repeating text twice?
  • or i should avoid multiple references?

example:

<html itemscope itemtype="http://schema.org/WebPage">
    <meta name="description" content="_________" itemprop="description">
    ...
    <div itemscope itemtype="http://schema.org/Review">
        <div itemprop="description">_________</div>
    </div>
    ...
</html>

the description belongs to the Review AND to the WebPage, so... what I should write in this case?

(note: in the previous example the string "__" is the same text paragraph, repeated twice)


EDIT:

can this be a solution? (the html5 spec doesn't talk about this, but defines the itemref attribute)

<html itemscope itemtype="http://schema.org/WebPage" id="WEBPAGE">
    ...
    <div itemscope itemtype="http://schema.org/Review" id="REVIEW">
        <div itemprop="description" itemref="WEBPAGE REVIEW">_________</div>
    </div>
    ...
</html>

FEEL FREE TO IMPROVE THE QUESTION!

like image 420
skyline26 Avatar asked May 02 '12 20:05

skyline26


People also ask

What is schema markup?

Schema markup, found at Schema.org, is a form of microdata. Once added to a webpage, schema markup creates an enhanced description (commonly known as a rich snippet), which appears in search results.

What is schema microdata?

Microdata is a form of structured data which is used to insert metadata within existing webpage content. In a nutshell, microdata allows you to provide labels for individual content elements using 'name:value' pairs.

What is howto schema?

What is How-To Schema? For those wondering what is Schema, it's a way of marking up content for Google and other search engines to make it easier for them to parse out things like supplies, instructions, photos, etc.

What is the example of microdata?

For example, Yandex, a major search engine in Russia, supports microformats such as hCard (company contact information), hRecipe (food recipe), hReview (market reviews) and hProduct (product data) and provides its own format for the definition of the terms and encyclopedic articles.


1 Answers

Quick answers

  • how to deal with duplicate contents?
    • use the attribute itemref
  • is correct making elements belong to two or more scopes?
    • Yes, this is what you use itemref for
  • how to do this, repeating text twice?
    • No, you only need to refer to the element
  • or i should avoid multiple references?
    • I don't see any reason why you don't wanna use multiple references

Some Examples

Include by wrapping

When you use the itemref attribute you include all property contained within the referred element to a different scope.

<body itemscope itemtype="http://schema.org/WebPage" itemref="wrapper">
    ...
    <div itemscope itemtype="http://schema.org/Review">
        ...
        <div id="wrapper">
            <div itemprop="description">_________</div>

            <div itemprop="some-other-property">_________</div>
        </div>
        ...
    </div>
    ...
</body>

Include by wrapping - a different example

Lets say you have a product with a few different offers outside the scope.

<div itemscope itemtype="http://schema.org/Product" itemref="wrapper">
    ...
</div>

<div id="wrapper">
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        ...
    </div>

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        ...
    </div>

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        ...
    </div>
</div>

Include a specific property

You might only wish to include one specific property outside the scope, to do this we can simply set the id directly on the targeted element with the itemprop specified.

<body itemscope itemtype="http://schema.org/WebPage" itemref="target">
    ...
    <div itemscope itemtype="http://schema.org/Review">
        <div id="target" itemprop="description">_________</div>
    </div>
    ...
</body>

Multiple references

Maybe a wrapper isn't applicable, then you can use multiple references. You separate them simply by space.

<body itemscope itemtype="http://schema.org/WebPage" itemref="desc name">
    ...
    <div itemscope itemtype="http://schema.org/Review">
        <div id="desc" itemprop="description">_________</div>

        <div id="name" itemprop="name">_________</div>
    </div>
    ...
</body>

Source

See also thees pages for some other explanations and examples:
http://www.w3.org/TR/2011/WD-microdata-20110405/
http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html

like image 144
superhero Avatar answered Sep 19 '22 14:09

superhero