Fix canonical tag on WooCommerce Category pages

#639806
Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    We just looked at the page you shared above to illustrate the issue and we can see that the canonical is self-referencing which is the default in our plugin when the pages are set to be indexed.

    If you still have questions about the canonical do let us know.

    We are here to help!

    Kasper
    Rank Math free

    But it does not make sense to make woocommerce product category pages self-referencing. What i mean is, it is bad SEO practice to have /category/page/4/ with a canonical link to itself. Best SEO practice is that /category/page/4/ has a canonical link to /category/

    Otherwise, Google thinks /category/page/4/ and /category/ are competing against each other, right? And that makes it impossible to rank for your /category/ page. So how can i fix this? Are you sure you should not change this globally for RankMath users?

    Hello,

    Thank you for your patience.

    Rank Math sets a self-referencing canonical URL for pages that are set to index.

    Also, it is completely your choice if you want to keep the paginated pages indexed or not. However, it is recommended to noindex them if you have a lot of them as it can exhaust the crawl budget and slow down the indexing of your new posts.

    You can follow the steps in this link to set your paginated pages to noindex:
    https://rankmath.com/kb/how-to-noindex-paginated-pages/

    Moreover, if you want to set them to index and set the first page for the canonical, you may use this filter:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
        global $wp;
        $current_slug = home_url( $wp->request );
    
        if ( is_paged()) {
            $canonical = $current_slug . '/';
        }
    
        return $canonical;
    });

    And here’s a guide on how you can add a filter to your website:
    https://rankmath.com/kb/filters-hooks-api-developer/

    Hope that helps.

    Kasper
    Rank Math free

    Thanks, is this guide (https://rankmath.com/kb/how-to-noindex-paginated-pages/?_gl=1*1gezkq0*_ga*MzE0MTE2NDEzLjE2OTM0NzY5NDU.*_ga_WTF2SQ5LGQ*MTY5NTcyNTA3My4yMy4xLjE2OTU3MjUxMTIuMjEuMC4w) only no-indexing woocommerce /category/page/x pages? Because I dont want to noindex anything else than that.

    Hello,

    Thank you for your patience.

    The Rank Math feature to noindex paginated pages will affect all of your paginations.

    If you wanted to set your WooCommerce product category pagination only, then you may need to use this filter instead:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    if ( is_product_category() && is_paged()) {
    	$robots['index'] = 'noindex';
    	return $robots;
    }
    return $robots;
    });

    Looking forward to helping you.

    Kasper
    Rank Math free

    And when you say all paginated pages, can you list what you mean then? Will it mean that the following will be noindexed?:
    website.com/post-category/page/X
    website.com/tag/page/X
    website.com/woocommerce-category/page/x

    And is it possible to put your code snippet into a wordpress plugin?

    Hello,

    Yes, all of your paginated pages (if available) will be set to noindex like the sample URLs you have shared.

    Regarding the filter, you may use the Code Snippets plugin to apply it to your site.

    Here’s the section you can follow for that:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/#code-snippets-plugin

    Looking forward to helping you.

    Kasper
    Rank Math free

    As you can see here (https://imgur.com/a/p9tFGQT), I have tried to noindex as you told. However, I still find some problems.

    When i go to https://plantpare.dk/shop/ it has proper tag: <meta name="robots" content="follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large"/>

    When i go to https://plantpare.dk/shop/page/2 it also has proper tag: <meta name="robots" content="follow, noindex"/>

    But, but, but, when I then access a category page, I see problems.

    When i go to https://plantpare.dk/havehegn/ it has proper tags: <meta name="robots" content="follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large"/>

    When i go to https://plantpare.dk/havehegn/page/2/ it has these tags:

    <meta name="robots" content="follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large"/>
    <link rel="canonical" href="https://plantpare.dk/havehegn/page/2/" />
    <link rel="prev" href="https://plantpare.dk/havehegn/" />
    <link rel="next" href="https://plantpare.dk/havehegn/page/3/" />

    … So what to do. I have checked the paginated settings correct, right?

    Hello,

    Thank you for your patience.

    The product category paginated should be set to noindex with that option.

    Please try clearing your website’s cache and check again the robots meta tag.

    If the issue still persists, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Kasper
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Kasper
    Rank Math free

    Are you there? I have sent the login credentials.

    Hello,

    We deeply apologize for the delay in response.

    We’ve checked your website and found that the Noindex Subpages and Noindex Paginated Single Pages both options were disabled. However, after enabling these options from Rank Math > Titles & Meta > Misc Pages, your category paginated pages are currently set to noindex:

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    Kasper
    Rank Math free

    Thank you

    Hello,

    Glad that helped.

    If you have any other concerns, please don’t hesitate to contact us anytime to assist you further.

    Looking forward to helping you.

    Thank you.

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

The ticket ‘Fix canonical tag on WooCommerce Category pages’ is closed to new replies.