Not able to index my /cart and checkout page

#266873
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

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

    Those pages should not be indexed as the content from them is very specific for each user and as such, there’s no real SEO benefit in having them being indexed.

    By default, our plugin sets those as noindex because of this same reason.

    ​​​​​​Hope this helps clarify your doubts.

    Don’t hesitate to get in touch if you have any other questions.

    thank you for your reply, but I can get red highlighted in the search console in the coverage tab – I need to fix this red issue that irritating me also I have created a funnel for the sales and made /cart and /checkout URLs in that funnel, will that show me the data even the page is not been indexed – your reply is anticipated, please.

    Hello,

    You can add the following filter to change those pages to index on your website:

    
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
        if ( is_cart() || is_checkout() ) {
            $robots['index'] = 'index';
            $robots['follow'] = 'follow';
        }
        return $robots;
    });
    

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Please guide where i need to put this code and how ?

    Anas
    Rank Math business

    Hello,

    You should add the filter code in theme’s functions.php file.

    Here is a guide for your reference:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/#functions-php-file

    You can also add the filter using the Code Snippets plugin:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/#num-1-1-install-code-snippets-plugin

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Nigel
    Rank Math business

    Hello,

    I have successfully implemented a code snippet that sets the robots meta of your cart, checkout, my account pages to index. To make sure the snippet does not get overwritten by a future theme update, please create a child theme and copy the code snippet to the child theme functions.php.

    
    /**
    * Changes robots meta for WooCommerce checkout, cart and account pages.
    * Beware that these pages typically should never be indexed.
    *
    * @param array $robots The meta robots directives.
    */
    add_filter( 'rank_math/frontend/robots', function ( $robots ) {
        if(is_checkout() || is_cart() || is_account_page())
        {
            $robots['index'] = 'index';
        }
        
        return $robots;
    });
    

    That said, we highly recommend you do not set those pages to be indexed. If you can explain what you are trying to achieve, we may be able to give you a better solution.

    I hope that helps. If you have questions, ask away.

    thank you for your help if it is not necessary then I am not going to index these pages

    Hello,

    I am glad that we could address your concern.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

You must be logged in to reply to this ticket.