Product Markup

#31885
  • Resolved Michael Martin
    Rank Math free

    Hi all,

    Because I am not able to get the Product schema to work within RankMath I am adding to the header manually. The markup code I am adding is present and correct in View Source, but when I check in Structured Data Testing Tool, it is getting mixed up within a Breadcrumb list item. Please can you advise. I would post links, but every time I do that my post gets marked “awaiting moderation” and doesn’t seem to get answered.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Todd
    Rank Math free

    Hi Michael,

    Thanks for getting in touch with us.

    Product markup should work correctly. You can check this guide for instructions:
    https://rankmath.com/kb/rich-snippets/#product

    Where did you get the custom code and can we see what it is?

    Which doesn’t make any sense to me (or to Google I imagine)

    Hello,

    Thank you for contacting Rank Math today.

    If you would like to add the custom schema and have it working without conflicts, then I can suggest that you hook into the following filter to add the custom schema:

    /**
     * Collect data to output in JSON-LD.
     *
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
            if(is_singular('post type name here')){
    	$data['Product'] = [
    			'@context' => 'https://schema.org',
    			'@type'    => '',
    			'@id'      => '',
    			'name'     => '',
    			'url'      => '',
    			'sameAs'   => '',
    		];
    	return $data;
    	}
    	return [];
    }, 10, 2);

    Looking forward to helping you. Thank you.

    ​​​​​​

    • This reply was modified 4 years, 2 months ago by Michael Davis.

    Hi Michael,

    Thank you for this. Can I just check – it mentions inserting post type name, does that mean it only works for blog posts? I’d need the custom schema to work for my pages. The blog posts can take the default Article schema no worries.

    Also can I just check what this does? I’m not able to make it out from the code. It looks like it’s blanking out fields, but if I select Schema Type of None in Page edit, would this not achieve the same thing?

    Todd
    Rank Math free

    Hi Michael,

    First of all, you should not use more than one product Schema per page. It does not make much sense and would only confuse Google.

    You have one product for 300 ZAR and then next can be 350. Which one will Google use in their rich snippets?

    It is best to use one product Schema per page and for your archives, you can use collectionpage Schema which would be more suitable.

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    If you want to extend the Schema, you are going to have to do it yourself. We can give you the pointers but we cannot help write or decode code. When you ask for custom code, we assume that you are already familiar with coding and just need help asking for a filter.

    If you have any Rank Math related queries, we are here for you.

    Thank you.

    Hello Todd,

    First of all, how then do online shops deal with it? Let’s have a look. As an example:

    view-source:https://hellopretty.co.za/reclaim-design

    They are using multiple schema to deal with multiple products (in this case microdate as opposed to JSON. I chose JSON because Google recommended it).

    If I use one product per page then I will have content that is thin on each page (I cannot write 1000 words per page on each product that would be mental), so I’d disagree that it does not make sense to group products.

    Furthermore my schema markup validates with the *Google* Structured Data Testing Tool, so if, as you say, Google will be confused, it would throw an error.

    I am not asking you to make a customized solution. I am asking for clarification of what is possible within RankMath. When you offer support for a product I assume you are the experts in that product, and as such will field questions and provide helpful answers. I am already working to extend the schema myself, thank you for pointing out the obvious.

    “If you have any RankMath related queries, we are here for you” – how are queries on product schema *NOT* related to RankMath? If you are “here for me”, then I’d appreciate less condescending replies.

    It comes across to me that you guys are begrudging in offering your assistance. On the one hand you say things like “we’re here for you”, on the other you say I’ll have to sort it out myself.

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    It seems like your custom markup, even though it is valid, it is still conflicting with breadcrumbs. If you don’t mind, you can try out the filter suggested previously and let us know how it goes.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello,

    We are glad you found the solution. I just want to clarify a few things here:

    If I use one product per page then I will have content that is thin on each page (I cannot write 1000 words per page on each product that would be mental), so I’d disagree that it does not make sense to group products.

    – It’s not necessary to have 1000 words per page and having 1000 words doesn’t guarantee higher ranking. Different schema types require different fields that describes the content of the page. This helps Search Engines understand what the content on your page means not just what it says. So for the Product schema, the required information which Search Engines looks for is the price of the product, some description, category, and other attributes and reviews if available.

    I see you are using a custom page on your site which lists all the products. I don’t think it’s a good idea to have a product markup which competes with individual product pages for the search placement. You might end up getting warnings in the GSC. That’s the reason we have provided options in the Settings to enable/disable the Product schema on the archive pages and even WooCommerce doesn’t add product schema on the archive pages.

    I hope this clears the confusion. If you have any further question(s), please let us know.

    Thank you.

    Hi Pratik

    I’m glad too. I’m using a methodology recommended by one of the moderators on Google Webmaster Forum, and it validates without breaking breadcrumb schema, so will run with that for now as I’ve spent far too long on this particular problem. On to the next one….

    Todd
    Rank Math free

    Michael,

    Sure, sounds good.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘Product Markup’ is closed to new replies.