Canonical

#362685
Viewing 7 replies - 1 through 7 (of 7 total)
  • Anas
    Rank Math business

    Hello,

    Thank you for contacting Rank Math, and sorry for any inconvenience caused.

    You can add this filter in the theme’s functions.php file to remove the adjacent links ( next/prev ):

    /**
     * Allows developers to handle rel="next" / rel="prev" by themselves.
     *
     * @param bool $links_generated Whether or not to handle rel="next" / rel="prev" links.
     */
    add_filter( 'rank_math/frontend/disable_adjacent_rel_links', '__return_true' );

    Here is a guide you can follow to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    If you do not want the paginated pages to get indexed in Google, you can set them to noindex by going to WordPress Dashboard > Rank Math > Titles & Meta > Misc. Pages

    Here is a guide for your reference:
    https://rankmath.com/kb/how-to-noindex-paginated-pages/

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you for your response. However, what I want is to give the canonical tag to the homepage on page/* …. pages. How we can solve this problem.

    Hello,

    Please use the filter given below to set the canonical URL of the paginated pages as the URL of your homepage:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
            if (is_paged()) {
                    return 'https://uzmantavsiyesi.net/';
            }
    	return $canonical;
    });

    Here is how to add the filters to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Also, if you don’t want to index your paginated pages then instead of changing the canonical URL, you can directly set them as noindex from WP Dashboard > Rank Math > Titles & Meta > Misc Pages > Noindex Paginated Pages and Noindex Archive Subpages.

    Hope this helps. Let us know if you need any other assistance.

    Thanks.

    Thank you for your response. But there was no change on other codes. Only new codes have been added from line1.
    Screenshot:
    1. https://prnt.sc/9L-WK2KMUuXe
    2. https://prnt.sc/E4AC05J5H802
    3. https://prnt.sc/r2LLpqY3s228

    Hello,

    Please add the code inside the PHP tags. Your code should look like this in the file:

    <?php 
    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
            if (is_paged()) {
                    return 'https://uzmantavsiyesi.net/';
            }
    	return $canonical;
    });
    ?>

    It should work fine after adding the PHP tags. Let us know how that goes.

    Looking forward to helping you.

    Thanks.

    Thank you for your response. The problem has been eliminated. I request you to edit this in the new update.
    Good day, good work.

    Hello,

    We are super happy that this resolved your issue.

    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.

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

The ticket ‘Canonical’ is closed to new replies.