Canonical tag i dont want in first page

#752957
  • Resolved Alessandro Ritondale
    Rank Math free

    Hi. In woocommerce category page i have similar page domain.com/phone and this have pagination as domain.com/phone/page/2. In first page domain.com/phone in source code have the canonical tag like this <link rel=”canonical” href=”https://domain.com/phone/&#8221; /> i want that canonical tag are present only in pagination. It’s possibile Tnks

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

    I understand your concern about the canonical tag in WooCommerce category pages. If you want to have the canonical tag present only in the pagination pages and not on the first page, you can achieve this by customizing the canonical URL settings in Rank Math.

    To set the canonical URL for pagination pages in Rank Math, you can follow these steps:

    1. Open the post/page that contains the pagination content.
    2. Navigate to the Advanced tab of Rank Math in your editor.
    3. In the Canonical URL field, specify the canonical URL for the pagination pages (e.g., https://www.yourwebsite.com/tag/product-1/).

    By setting the canonical URL specifically for the pagination pages, you can control which page should be considered as the main source of content for search engines like Google.

    If you encounter any difficulties while implementing this solution, please feel free to reply to this ticket for further assistance.

    Thank you for reaching out with your query.

    Sources:
    Advanced Tab in Rank Math SEO’s Meta Box
    Alternate Page with Proper Canonical Tag Status in Google Search Console » Rank Math
    Setting Canonical URLs in Rank Math » Rank Math
    Why Did My Website Disappear From Google Search? » Rank Math

    Hello,

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

    You can use the below filter/hook code on your site to set the paginated canonical url for the pages.

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
        if ( is_paged() ) {
            // Get the current URL
            $link = $_SERVER['REQUEST_URI'];
    
            // Extract the base part of the URL and the page number
            $arr = explode('/page/', $link);
    
            // Construct the canonical URL with the paginated part
            $canonical = home_url($arr[0] . '/page/' . $arr[1]);
        }
        return $canonical;
    });
    

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    We hope that helps, and please don’t hesitate to get in touch if you have any other questions.

    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 2 replies - 1 through 2 (of 2 total)

The ticket ‘Canonical tag i dont want in first page’ is closed to new replies.