I'm new to microdata and I have the following scenario for which I would like some help:
I wish to put microdata on product pages where, on the page, there can be multiple variations of the same product.
Each variation has the same name, description and image but they have each their own SKU, colour, size, weight and price.
On the page I have something like
<section id="commonparts">
<h1>Product name</h1>
<div><img src="productimage"></div>
<div>Product description</div>
</section>
<section id="variations">
<div id="variation1">
<div>SKU 1</div>
<div>Colour 1</div>
<div>Size 1</div>
<div>Price 1</div>
</div>
<div id="variation2">
<div>SKU 2</div>
<div>Colour 2</div>
<div>Size 2</div>
<div>Price 2</div>
</div>
</section>
Is it possible to microdata this?
Thanks in advance
You could make use of Microdata’s itemref attribute, so that you don’t have to duplicate the identical data.
Use the itemprop attributes on the data that is identical for all products, give each property an id, but don’t place these properties inside an itemscope:
<!-- no 'itemscope' parent -->
<section>
<h1 itemprop="name" id="product-name">Product name</h1>
<img itemprop="image" id="product-img" src="productimage" alt="" />
<p itemprop="description" id="product-desc">Product description</p>
</section>
On every product (each represented by a Product item), you list all the id values in its itemref attribute:
<section>
<div id="variation1" itemscope itemtype="http://schema.org/Product" itemref="product-name product-img product-desc">
<!-- properties specific to this 'Product' variation -->
</div>
<div id="variation2" itemscope itemtype="http://schema.org/Product" itemref="product-name product-img product-desc">
<!-- properties specific to this 'Product' variation -->
</div>
</section>
Related
I have a page containing multiple Articles, I want each one to describe the Publisher as an Organisation, but what I'd like to avoid is redefining that Organisation for every single article. Is this possible?
The itemref attribute only seems to work in the opposite direction, specifying a parent > child relationship, not the other way around.
In this example I've taken the organisation example from Schema.org which I hope illustrates the problem - you can't repeat this markup every time, it would bloat the page.
<div itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Google.org (GOOG)</span>
Contact Details:
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
Main address:
<span itemprop="streetAddress">38 avenue de l'Opera</span>
<span itemprop="postalCode">F-75002</span>
<span itemprop="addressLocality">Paris, France</span>
,
</div>
Tel:<span itemprop="telephone">( 33 1) 42 68 53 00 </span>,
Fax:<span itemprop="faxNumber">( 33 1) 42 68 53 01 </span>,
E-mail: <span itemprop="email">secretariat(at)google.org</span>
Members:
- National Scientific Members in 100 countries and territories: Country1, Country2, ...
- Scientific Union Members, 30 organizations listed in this Yearbook:
List of Alumni:
<span itemprop="alumni" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Jack Dan</span>
</span>,
<span itemprop="alumni" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Smith</span>
</span>
</div>
<div itemscope itemtype="http://schema.org/NewsArticle">
<meta itemprop="url" content="{{canonical_url}}" />
<link itemprop="mainEntityOfPage" href="{{canonical_url}}">
<meta itemprop="genre" content="{{genre}}" />
<meta itemprop="publisher" temtype="http://schema.org/Organization" content="{{???}}" />
<meta itemprop="dateModified" content="{{updated_at}}" />
<div class="item-content">
<div class="item-header" itemprop="name headline">
{{Headline}}
</div>
<div class="item-body">
<p itemprop="articleBody">
{{content goes here}}
</p>
</div>
<div class="item-footer">
<span itemprop="datePublished dateCreated">{{date}}</span> - <span itemprop="creator author copyrightHolder">{{byline}}</span>
</div>
</div>
</div>
I'm currently using microdata but if what I'm attempting is possible with JSON then I would consider switching.
If you have an Organization item and several Article items on the same page, you can use Microdata’s itemref attribute to provide the Organization item as value for the publisher property:
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization" id="publisher-1">
</div>
<article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
</article>
<article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
</article>
<article itemscope itemtype="http://schema.org/Article" itemref="publisher-1">
</article>
If using this, you have to make sure that the div (for the Organization item) is not a child element of another element with itemscope (otherwise it would be added to this item as publisher in addition).
opencms provides carousel element. but as per my requirement i need a carousel with thumbnail(which is not available in opencms). do i need to make changes in carousel.jsp(in com.alkacon.bootstrap.formatters/formatters). if it is the right way then provide some documentation regarding customization of carousel element.
<div class="carousel-inner">
<c:forEach var="item" items="${content.valueList.Item}" varStatus="status">
<div class="item<c:if test="${status.first}"> active</c:if>">
<cms:img alt="" src="${item.value.Image}" scaleType="2" scaleColor="transparent" scaleQuality="75" noDim="true" cssclass="img-responsive"/>
<div class="carousel-caption">
<c:if test="${item.value.Headline.isSet}">
<h3 ${item.rdfa.Headline}>${item.value.Headline}</h3>
</c:if>
<p ${item.rdfa.text}>${item.value.Text}</p>
</div>
</div>
</c:forEach>
</div>
I have some electronic components, and the price is floating.
For example, if you buy 5 pieces, it will be $1 each piece. and you buy 200 pieces, it will be $0.8 each pieces.
There's a order range and price sheet like this:
1~199 $1
200~500 $0.8
Can I mark this up in Schema.org (using Microdata)?
You can do this with multiple PriceSpecification (or in your case probably UnitPriceSpecification) items.
The eligibleQuantity property can give the quantity range in a QuantitativeValue item, with its minValue and maxValue properties.
If you want to provide a unitCode, you can use UN/CEFACT Common Code’s C62.
Based on your example (from the comment), it could look like this in Microdata:
<div itemscope itemtype="http://schema.org/Offer">
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification">
<div itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<meta itemprop="unitCode" content="C62" />
<span itemprop="minValue">1</span>-<span itemprop="maxValue">100</span>:
</div>
NT$<span itemprop="price">6.65</span>
</div>
<div itemprop="priceSpecification" itemscope itemtype="http://schema.org/UnitPriceSpecification">
<div itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<meta itemprop="unitCode" content="C62" />
<span itemprop="minValue">101</span>-<span itemprop="maxValue">200</span>:
</div>
NT$<span itemprop="price">5.70</span>
</div>
</div>
This is The structure of my first page site
<body>
<div class="header"></div>
<div class="left_col">List of last articles/news</div>
<div class="center_cod">List of feature articles/news</div>
<div class="right_col">other thing like ads,and other item list</div>
<div class="footer"></div>
</body>
What do you suggested me to use Microdata in each of element?
<body itemscope itemtype="http://schema.org/WebPage">
<div class="header" itemscope itemtype="http://schema.org/WPHeader"></div>
<div class="left_col" itemscope itemtype="?">List of last articles/news</div>
<div class="center_cod" itemscope itemtype="?">List of feature articles/news</div>
<div class="right_col" itemscope itemtype="?">other thing like ads,and other item list</div>
<div class="footer" itemscope itemtype="http://schema.org/WPFooter"></div>
</body>
Yes I know there is 'itemscope itemtype="http://schema.org/WPSideBar"' for sidebar...But I wana more cutomize it... for example can I use 'blog' or something like this?
My data is spread all over so I can't keep this format :
<div itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">
<p itemprop="description">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">
</div>
</div>
Like you see in the code below the first thing on the page is the category path which has to be inside Offer schema than I have the image and the title which belong to Product than I have eligibleQuantity that again belongs to the Offer and so on....
So I added the :
<div itemscope itemtype="http://schema.org/Product">
In the beginning of the page and closed it at the end and than whenever I had an element that does not belong to the product schema like "eligibleQuantity" for example I would do this:
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{L_901}: <span itemprop="eligibleQuantity">{QTY}</span><br />
</div>
The problem is I don't know if this is the correct way to do it and can't figure another way. I also get the "Warning: Incomplete microdata with schema.org."
Here is a link to the page :
https://www.pchounds.com/item.php?id=82627#.UTi7kRz_mSp
and below is some code from the page so you can have an idea what I did. Thank you.
<div itemscope itemtype="http://schema.org/Product">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="breadcrumb"> {L_041}:<span itemprop="category"> {TOPCATSPATH}</span> </div>
...........................................................................................
!-- IF B_HASIMAGE -->
<div class="span3" style="text-align:center"> <img class="img-polaroid" itemprop="image"
src="{SITEURL}getthumb.php?w={THUMBWIDTH}&fromfile={PIC_URL}" border="0" alt="title" align="center"><br>
<h1 itemprop="name" style="line-height:24px;">{TITLE}</h1>...........................................................................................
<!-- IF QTY gt 1 -->
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
{L_901}: <span itemprop="eligibleQuantity">{QTY}</span><br />
</div>
<!-- ENDIF -->
<!-- IF B_HASENDED -->
{L_904}<br />
<!-- ENDIF -->
<!-- IF ITEM_CONDITION -->
<b> {L_1036}:</b> <span itemprop="itemCondition">{ITEM_CONDITION}</span><br />
<!-- ENDIF -->
<!-- IF ITEM_MANUFACTURER -->
<b> {L_1037}:</b> <span itemprop="manufacturer">{ITEM_MANUFACTURER}</span><br />
<!-- ENDIF -->
<!-- IF ITEM_MODEL -->
<b> {L_1038}:</b> <span itemprop="mpn">{ITEM_MODEL}</span><br />
<!-- ENDIF -->
<!-- IF ITEM_COLOUR -->
<b> {L_1039}:</b> <span itemprop="color">{ITEM_COLOUR}</span><br />
<!-- ENDIF -->
<!-- IF ITEM_YEAR -->
<b> {L_1040}:</b> {ITEM_YEAR}<br />
<!-- ENDIF -->
</small>
offer must have a price, <span itemprop="price"> must be followed by the value of the price but is not and there are multiple Offers when there should just be one. Looking at the current test results from Google's structured data testing tool there are 5 errors, each states the price is missing.
The problem seems to be that each part of the offer has a separate `http://schema.org/Offer' at the start - so it is expecting 5 prices, one for each of the 5 offers.
What you need to do is declare http://schema.org/Offer' **once**, for example an extra` which remains open until all offer values are added.
<div itemscope itemtype="http://schema.org/Product">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div class="breadcrumb"> Item category:<span itemprop="category"> All > Electronics > Audio > Audio Components > Speakers</span>
</div>
<div class="row">
<div class="span3" style="text-align:center"> <img class="img-polaroid" itemprop="image" src="https://www.pchounds.com/getthumb.php?w=120&fromfile=uploaded/82627/82627.jpg" border="0" alt="title" align="center"><br>
</div>
</div>
</div>
<div class="span5">
<h1 itemprop="name" style="line-height:24px;">Creative Labs Speaker GigaWorks T20 Series II Systems 2.0 EPS complian</h1>
<div><!-- schema.org/Offer removed -->
<em>
<p><small>Buy Now:
<span itemprop="price"><b>108.91</b> USD</span></small></p>
</em>
</div>
<div class="span5">
<h1 itemprop="name" style="line-height:24px;">Creative Labs Speaker GigaWorks T20 Series II Systems 2.0 EPS complian</h1>
<div> <!-- removed http://schema.org/Offer -->
<em>
<p><small>Buy Now:
<span itemprop="price"><b>108.91</b> USD</span></small></p>
</em>
</div>
Shipping fee: <b>8.00</b> USD<br />
<small>Ends within:
<span id="ending_counter"><span class="errfont">closed</span></span><br />
<p> Seller location: United States<br />
<div> <!-- removed http://schema.org/Offer -->
<b>Payment methods:</b><span itemprop="acceptedPaymentMethod"> PayPal</span> </p>
</div>
</small>
...
</div>