: Microdata reuse within another item My intention is marking up my site with Microdata in a way I won't need to re-declare items that already exist in the page. For example, my header will
My intention is marking up my site with Microdata in a way I won't need to re-declare items that already exist in the page.
For example, my header will always contain info regarding the "Organization" that the website represents. Within the "Products" that I offer I can specify the "Brand" of that product. So the product's property "brand" will replicate the "Organization" info mentioned in the header.
Now I don't think I'm supposed to repeat the organization's markup within the brand property of the product item, since I feel there should be a way to reference that organization item directly.
I just haven't found a way to do this, are there any ideas? I've checked this answer and although useful it doesn't address my issue.
I tried messing with it however to give you an idea of my intentions:
<span itemscope itemtype="http://schema.org/Organization" itemref="myCompany">
<meta itemprop="name" content="Company Name" />
<meta itemprop="url" content="http://example.com/" />
<meta itemprop="description" content="description" />
</span>
<span itemscope itemtype="http://schema.org/Product">
<span itemprop="brand" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="id" content="myCompany" id="myCompany" />
</span>
<meta itemprop="name" content="Foo product" />
<meta itemprop="description" content="You can do Bar with it" />
</span>
This doesn't work since it adds the the "id" property to both "Organization" and "Product".
EDIT1:
zigojacko's answer didn't really go towards what I was expecting, since he uses a single container with all the information needed to present all the markup for his product.
However in my case the site layout isn't broken down into a container that would hold all the necessary information, as my company info is within the header and the products/offers are near the footer (as the main form to define those offers is above the fold) and other info is scattered between each of those containers.
As such I would eventually like to link the company (that resides in the header) to the brand of each product (that reside near the footer), I just wouldn't like to repeat all the code necessary to describe the company and therefor would prefer linking to some sort of item identifier.
There is also the possibility of nesting every bit of content within the page to the company, but as a comment to this question I mention that specific question in the Webmasters Stack Exchange. So I know how to pull that type of solution off, I'm just wondering if there's the possibility of referring to an existent item elsewhere on the page.
EDIT2:
In the comments of this question I might have found a better way to explain what I mean.
By pointers I mean an html attribute that could reference an Item. In
the code example I gave, I have a loose (not nested) Organization that
I would like to be inserted into my second item Product within it's
brand property, but without having to copy+paste or echo again within
the Product. I tried to simulate that behavior with the itemref
attribute.
More posts by @Deb1703797
2 Comments
Sorted by latest first Latest Oldest Best
Well, after poking google hard for several hours, it finally coughed up what I needed, right here
<div itemscope itemtype="http://schema.org/Person" itemref="a1 b"></div>
<p id="a1">Name: <span itemprop="name">Amanda</span></p>
<div itemscope itemtype="http://schema.org/Person" itemref="a2 b"></div>
<p id="a2">Name: <span itemprop="name">Fernando</span></p>
<div itemscope itemtype="http://schema.org/Person" itemref="a3 b"></div>
<p id="a3">Name: <span itemprop="name">Daniel</span></p>
<div id="b" itemprop="nationality" itemscope itemtype="http://schema.org/Country" itemref="c"></div>
<div id="c"><p>Nationality: <span itemprop="name">uk</span></p></div>
So the result is:
Person
name: Amanda
nationality [Country]:
name: uk
Person
name: Fernando
nationality [Country]:
name: uk
Person
name: Daniel
nationality [Country]:
name: uk
And I only declared "nationality" once in this block of code. So basically it's separating the nesting of HTML from the nesting of microdata items, or at least not making the mistake of assuming they should coincide, since in most cases we don't think our data or layout according to schema.org's items.
Hope this helps someone who's banging their head as hard as I did.
The Schema markup for a product should be like:-
<div itemscope itemtype="http://schema.org/Product">
<a itemprop="url" href="http://www.example.com/product">
<div itemprop="name"><strong>Product Name</strong></div>
</a>
<div itemprop="description">This is my product description.</div>
<div itemprop="brand" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">My Brand</span></div>
<div itemprop="manufacturer" itemscope itemtype="http://schema.org/Organization">
Manufactured by: <span itemprop="name">The Manufacturer</span></div>
<div>Model: <span itemprop="model">V1.0</span></div>
<div>Product ID: <span itemprop="productID">abc</span></div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">5</span> based on <span itemprop="reviewCount">149</span> reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer"><span itemprop="price">£9.99</span><link itemprop="itemCondition" href="http://schema.org/NewCondition" /> New
</div>
</div>
It is perfectly okay to include the itemtype 'Organization' for the brand within a product schema if there is an organisation declared in the header of your page.
You could in fact have 10 products on a page all with different brands providing it is marked up within the Product itemtype.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.