I initially installed and tried out the RDFx module but quickly realised I don't really know how to use it - there wasn't any documentation that I can refer to. As I could not remove the various RDF mappings after disabling the module, I followed the instructions provided here #1296814: Help to remove imported libraries and cleanup automated rdf mappings to clear these mappings.
I'm just mentioning the above in case it's related somehow.
Then I installed the schema.org module. I went to my Product content type (I'm using Ubercart), edited it, and under Schema.org's settings, I selected "Product" to be the "type", followed by "name" for the "Title property".
I then edited 2 other fields to associate the correct fields accordingly, such as "manufacturer" and "image".
Then I went to http://www.google.com/webmasters/tools/richsnippets to preview my page, and there wasn't any data that Google has managed to extract at all.
I looked at my source code, and did a quick Ctrl+F search for "schema", and only found the following codes:
<meta content="ABC" about="/link/abc" property="schema:name dc:title" />
<div class="field-item even" rel="schema:manufacturer"><a href="/publisher/repos-production" typeof="skos:Concept" property="rdfs:label skos:prefLabel">XYZ</a></div>and bizarrely enough,
<span property="schema:name dc:title" content="ABC" class="rdf-meta"></span>
where ABC is the name of my product. I'm not sure why the above span code appears when there's nothing being enclosed. I also noticed that the Product schema.org type was not defined somehow, and perhaps this might explain why Google Rich Snippets did not preview anything.
Have I done something wrong here?
Comments
Comment #1
scor commentedthat's a feature of the module. This is added because the title of the node cannot be easily wrapped with its schema.org property, so the title is added in this hidden property part of the rendered content.
As for the schema.org product type, it might be that Google does not yet support it in its rich snippets. For now only person, event and recipes have been found to work. they're always improving their tooling, so hopefully more types like product will be supported in the future.
Comment #2
scor commentedubercart for Drupal 7? is it using nodes for products? if it's not using nodes, then this is the issue you want to work on: #1296760: Support for setting type on Entity.
Note that Drupal Commerce is probably a better bet to build e-commerce sites in Drupal 7, and more likely to get schema.org support before ubercart.
Comment #3
Quarantine commentedThanks a lot for the quick reply scor!
If I understand you correctly, I do believe Google supports schema.org's Product type, based on this link: http://www.google.com/support/webmasters/bin/answer.py?answer=146750
Based on that link and the examples provided, I suspect that my site is missing the following code:
<div itemscope itemtype="http://schema.org/Product">But I'm not entirely sure how to get that to appear. Would you recommend that I use rdfx instead? (If so, would you know of a resource that I can look at to understand how I can use rdfx to suit my needs?)
Also with regards to e-commerce, I did try looking into Drupal Commerce, but I found Ubercart more useable out-of-the-box. I'm not a coder, so I found Ubercart more easy to tweak and customise due to the wide variety of contrib modules available for Ubercart.
And yep, I'm using Ubercart 3 for Drupal 7. It is indeed using nodes for products.
Comment #4
scor commentedDid you set the right mapping to "Product" on the content type edit form? if so, I suspect your theme might be doing something funky. Try to switch to a core theme like Bartik and see if you still are missing this markup. Also try to create a new custom content type from scratch and assign a type to it (e.g. Product), and see if it's present in the HTML.
no, it won't help with the markup, it's the same logic as schema.org.
Comment #5
Quarantine commentedI think you hit the nail on the head with my theme (which I purchased elsewhere). I did indeed set the right mapping to "Product" at the content type edit form, but the aforementioned code wouldn't appear on my theme.
I then switched to the Bartik core theme, then viewed my source, searched for instances of "schema", and saw that there are 26 instances that contain the word "schema", as opposed to just 3 with the custom theme I purchased. I then used Google's Rich Snippets Testing Tool to preview my page again, and it could extract all the "rich snippet data".
I know this question might be difficult for you to answer, but would you know which specific theme file I should investigate as to what's missing in my theme compared to the Bartik core theme?
The following is the schema-related code that appeared in Bartik but not in my custom theme:
Edit: Thanks to this page http://drupal.org/node/778988, I managed to re-insert the above code into my custom theme again (in its html.tpl.php file). Haven't managed to find out how to do that for the following code.
and (the following I believe is the code that defines schema.org's "type"):
<div id="node-22" class="node node-product node-promoted node-full clearfix" about="/board-games/abc" typeof="schema:Product sioc:Item foaf:Document">and multiple instances of the following (as I have multiple images):
<div class="field-item even" rel="schema:photo schema:image" resource="http://URL.com/sites/default/files/styles/uc_product/public/7-wonders-leaders.jpg"><a href="http://URL.com/sites/default/files/abc1.jpg"><img typeof="foaf:Image" src="http://URL.com/sites/default/files/styles/uc_product/public/abc1.jpg" alt="ABC" title="ABC" /></a></div>PS: I'm using the php codes the enclose the above codes instead of [code] as the highlighted tags look better here.
Comment #6
scor commentedThis is generated by node.tpl.php, please make sure your theme node.tpl.php has
<?php print $attributes; ?>in the first div element (check module/node/node.tpl.php for an example).Check if your theme contains a field.tpl.php override. Look at modules/field/theme/field.tpl.php for a working example which should include several print $*attributes statements.
Comment #7
Quarantine commentedThanks for the reply again scor! I really appreciate it.
I took a look at my theme's node.tpl.php, and it does have the
print $attributes;code in it:<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>So I'm puzzled why the code similar to
<div id="node-22" class="node node-product node-promoted node-full clearfix" about="/board-games/abc" typeof="schema:Product sioc:Item foaf:Document">refuse to be generated.As for field.tpl.php, there doesn't seem to be such an override for my custom theme, but thanks for the note about modules/field/theme/field.tpl.php. It's likely that I need to modify my Ubercart theme's node--product.tpl.php and incorporate the $*attributes statements like you mentioned - I'll research that.
Comment #8
scor commentedthen check any other node--*tpl.php override such as node--product.tpl.php. If that's failing, you will have to dig through the preprocess functions of your theme and see if it drops some of the variables...
Comment #9
Michael_Activelamp commentedI just recently installed the schema.org module and have been playing with this module to learn more about it. I am currently working on a small drupal commerce site (5 pages, 1 product), where I am trying to insert schema so i can use the snippet tool to see if it is working. Is there another tutorial or video I can watch other than http://vimeo.com/29821887 ? The last post looks like back in Oct 2011, is there a newer post somewhere? I would like to know how to adjust products to display on snippets, even if its a work around, until schema.org and drupal commerce starting working together.
Comment #10
scor commented@Michael_Activelamp I haven't tried the Product type yet, so can't tell you if Google is already understanding the schema.org Product type or if it only understand Good Relations at the moment. I know GR works with Google, just not 100% sure re schema.org / Product.
Comment #11
Michael_Activelamp commented@scor Hey thanks for the quick response!
Well I am new to this schema concept, so I was trying to use terms from http://schema.org/Product to describe my product, just setting images, price and description.
Basically on commerce I was adjusting my schema.org fields from store > products > product types > product > manage fields and also the content type > product display.
I don't even know if that is right, but I've been trying to different variations trying to get the google snippet tool to work.
Comment #12
scor commentedI posted a product test page at http://schema.openspring.net/product/green-beans and it seems to work in the testing tool. I used price, currency and availability as properties for my fields.
Comment #13
Allthegearnoidea commentedI've had a go at getting products to appear (I'm using D7 and Ubercart) but to no avail although the code seems to be there Google won't recognise it.
Have the rules changed at Google's end? Is anyone successfully getting products (through Ubercart) showing in Google's testing tool?
Comment #14
remkovdz commentedI'm also very curious if anyone has managed to show their Ubercart products with Rich Snippets..!?
Comment #15
summit commentedhi,
I am curious for a working example and how to for commerce products please (Drupal Commerce)?
Greetings, Martijn
Comment #16
scor commentedHere is an example of a working commerce product powered by https://drupal.org/project/commerce_goodrelations:
http://commerce.openspring.net/bags-cases/go-green-drupal-commerce-reusa...
preview: http://goo.gl/y9RlPF
live: http://goo.gl/RwEPyO
Comment #17
summit commentedHi,
I do not see price in your live example: http://goo.gl/RwEPyO)
If it should work, did you do anything related to settings?
greetings,
Martijn
Comment #18
scor commentedYou are right, the price is shown on the preview, but not on the live result. Not sure why that is.
Comment #19
summit commentedHi, sorry to have to report that.
I do not know if those issues are connected, but I do not see price also as explained in: https://drupal.org/node/2055567
greetings, Martijn
Comment #20
scor commentedI'm closing this issue now that https://drupal.org/project/commerce_goodrelations exists. The problem you are having is not that Google cannot detect that it's a product, but that the price is missing. Let's continue the conversation at #2055567: Installed the module but the Structured Data Testing Tool returns no results.