-
Notifications
You must be signed in to change notification settings - Fork 119
Avoid including itemprop from child itemscopes when using itemref #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <!DOCTYPE HTML> | ||
| <html> | ||
| <head> | ||
| <title>Photo gallery</title> | ||
| </head> | ||
| <body> | ||
|
|
||
| <div id="product" itemscope itemtype="http://schema.org/Product" itemref="referenced-product more-properties related_products non-existing-ref"> | ||
| <span itemprop="brand">ACME</span> | ||
| <span itemprop="name">Executive Anvil</span> | ||
| <img itemprop="image" src=" anvil_executive.jpg" alt="Executive Anvil logo"/> | ||
| <span itemprop="description">Sleeker than ACME's Classic Anvil, the | ||
| Executive Anvil is perfect for the business traveler | ||
| looking for something to drop from a height. | ||
| </span> | ||
| Product #: <span itemprop="mpn">925872</span> | ||
| <span id="aggregateRating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> | ||
| <span itemprop="ratingValue">4.4</span> stars, based on <span itemprop="reviewCount">89 | ||
| </span> reviews | ||
| </span> | ||
|
|
||
| <span id="offer" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||
| Regular price: $179.99 | ||
| <meta itemprop="priceCurrency" content="USD" /> | ||
| $<span itemprop="price">119.99 </span> | ||
| (Sale ends <time itemprop="priceValidUntil" datetime="2020-11-05"> | ||
| 5 November!</time>) | ||
| Available from: <span id="organization" itemprop="seller" itemscope itemtype="http://schema.org/Organization"> | ||
| <span itemprop="name">Executive Objects</span> | ||
| </span> | ||
| Condition: <link itemprop="itemCondition" href="http://schema.org/UsedCondition"/>Previously owned, | ||
| in excellent condition | ||
| <link itemprop="availability" href=" http://schema.org/InStock"/>In stock! Order now! | ||
| </span> | ||
| </div> | ||
| <div id="referenced-product" itemscope itemtype="http://schema.org/Product" itemprop="referenced_product"> | ||
| <span itemprop="name">REFERENCED PRODUCT</span> | ||
| <img itemprop="image" src="img-ref.jpg"> | ||
| </div> | ||
| <div id="more-properties" itemscope itemtype="http://schema.org/Product"> | ||
| <span itemprop="prop3">REFERENCED TO INCLUDE PROPERTIES AND ALSO INDIVIDUAL PRODUCT</span> | ||
| <img itemprop="image" src="img-2.jpg"> | ||
| </div> | ||
| <div id="related_products"> | ||
| <div itemscope itemtype="http://schema.org/Product" itemprop="related_products"> | ||
| <span itemprop="name">REL PROD 1</span> | ||
| <img itemprop="image" src="rel-prod-1.jpg"> | ||
| </div> | ||
| <div itemscope itemtype="http://schema.org/Product" itemprop="related_products"> | ||
| <span itemprop="name">REL PROD 2</span> | ||
| <img itemprop="image" src="rel-prod-2.jpg"> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| [ | ||
| { | ||
| "type": "http://schema.org/Product", | ||
| "properties": { | ||
| "referenced_product": { | ||
| "type": "http://schema.org/Product", | ||
| "properties": { | ||
| "name": "REFERENCED PRODUCT", | ||
| "image": "img-ref.jpg" | ||
| } | ||
| }, | ||
| "prop3": "REFERENCED TO INCLUDE PROPERTIES AND ALSO INDIVIDUAL PRODUCT", | ||
| "image": [ | ||
| "anvil_executive.jpg", | ||
| "img-2.jpg" | ||
| ], | ||
| "related_products": [ | ||
| { | ||
| "type": "http://schema.org/Product", | ||
| "properties": { | ||
| "name": "REL PROD 1", | ||
| "image": "rel-prod-1.jpg" | ||
| } | ||
| }, | ||
| { | ||
| "type": "http://schema.org/Product", | ||
| "properties": { | ||
| "name": "REL PROD 2", | ||
| "image": "rel-prod-2.jpg" | ||
| } | ||
| } | ||
| ], | ||
| "brand": "ACME", | ||
| "name": "Executive Anvil", | ||
| "description": "Sleeker than ACME's Classic Anvil, the\n Executive Anvil is perfect for the business traveler\n looking for something to drop from a height.", | ||
| "mpn": "925872", | ||
| "aggregateRating": { | ||
| "type": "http://schema.org/AggregateRating", | ||
| "properties": { | ||
| "ratingValue": "4.4", | ||
| "reviewCount": "89" | ||
| } | ||
| }, | ||
| "offers": { | ||
| "type": "http://schema.org/Offer", | ||
| "properties": { | ||
| "priceCurrency": "USD", | ||
| "price": "119.99", | ||
| "priceValidUntil": "2020-11-05", | ||
| "seller": { | ||
| "type": "http://schema.org/Organization", | ||
| "properties": { | ||
| "name": "Executive Objects" | ||
| } | ||
| }, | ||
| "itemCondition": "http://schema.org/UsedCondition", | ||
| "availability": "http://schema.org/InStock" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "type": "http://schema.org/Product", | ||
| "properties": { | ||
| "prop3": "REFERENCED TO INCLUDE PROPERTIES AND ALSO INDIVIDUAL PRODUCT", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry maybe I'm reading the schema incorrectly, but why do we have a separate product with its properties duplicated also in the product above?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The product with id Regarding if that should be behaviour or not, I'm not completelly sure. This is the standard definition of There is an algorithm definition here: https://www.w3.org/TR/microdata/#associating-names-with-items but I didn't go so deep for this patch as it seems it is not the same approach followed by I have just tested this html in Google Dev Tools and it also extracts the product isolated, but it is not including
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks for checking this @ivanprado . I think the current approach makes sense for |
||
| "image": "img-2.jpg" | ||
| } | ||
| } | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand, if there were several elements with the same
id, they were all extracted, but now just the first one is extracted? I realise that there supposed to be only one element with eachidso this seems fine.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see... I went to standard: https://www.w3.org/TR/html401/struct/global.html#h-7.5.2
So I think is safe to expect just one.