HTML Blocks showing in meta description

#405155
  • Hello.
    On our product page, we are displaying an HTML block under the product title. Unfortunately, the content of the block is displayed in the google meta description instead of the product description.

    How to disable to HTML block from being displayed and show a section of the product description in the meta?

    Images attached. Thank you for your help

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

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

    Can you please share the affected product URL with us so we can further check it on our end? You can insert the URL in the Sensitive Data section.

    Looking forward to helping you on this one.

    Hello,

    I have updated the sensitive data as requested. BUT, this is a problem with all the products, not just this one.

    Thank you.

    Prabhat
    Rank Math agency

    Hello,

    I checked the source of the page and there is a different meta description set than the desired one. Please have a look at the screencast in the sensitive data section of this ticket.

    Please update the meta description with the desired one: https://rankmath.com/kb/seo-meta-tags/#seo-description-classic-editor

    Further, clear your website’s cache and wait for Google to crawl the website again and see if the description on the SERP updates.

    Do note that if everything’s fine and Google still decides to show a different meta title/description, then there is nothing you can do, other than further optimize the meta title/description, as Google sometimes ignores the custom meta info altogether and show something from the page’s content that matches the search intent better.

    Hope this helps.

    Thank you.

    Hi again. Thank you for your reply.

    Is there a way to set the default meta for all products? Or prevent google from indexing HTML blocks? We have over 700 products and 4 domains, so editing products one by one is not really an option.

    Thank you.

    Prabhat
    Rank Math agency

    Hello,

    This is the order we follow to generate meta descriptions for WooCommerce products:
    1. Content from the SEO Description field
    If that is missing, then:
    2. WooCommerce Excerpt or Product Short Description
    If that is missing, then:
    3. Template From General Settings in WordPress Dashboard > Rank Math > Titles & Meta > Products
    If that is missing, then:
    4. Auto generated Content from the product page

    If you wish to give more preference to the description set in Titles & Meta > Products, then you can add the below code in your theme’s functions.php file:

    add_action( 'rank_math/frontend/description', function( $generated ) {
    	if ( ! is_product() ) {
    		return $generated;
    	}
    	global $post;
    	$desc = RankMath\Helper::get_settings( "titles.pt_product_description" );
    	$desc = RankMath\Helper::replace_vars( $desc, $post );
    	return empty( $desc ) ? $generated : $desc;
    });

    If you wish to automatically use the Product Long Description as the meta description and you’ve added some content in the Short Description field, you can add the above code to the website and modify and use this filter to register a variable for getting the Long Description: https://rankmath.com/kb/filters-hooks-api-developer/#add-extra-variables

    Further, use that variable in the “Single Product Description” field under Rank Math > Titles & Meta > Products, and see if you get the desired output.

    Hope this helps.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘HTML Blocks showing in meta description’ is closed to new replies.