Change/Remove Rel=Next & Rel=Prev

#53129
  • Resolved Sam Skellett
    Rank Math free

    Hi,

    I’m using the divi theme and woocommerce. On my product category pages the URL for the second page in the series is /slug/?product-page=2, whereas RankMath within the rel=next tag has it as /slug/page/2/. Furthermore, the URL that RankMath creates shows identical products to those which are on the 1st page of the series (it does not change the content in any way).

    Is it possible to change the URL of the rel=next and prev tags so I can align the two? Currently it’s creating duplicate content.

    If this is not possible, is there anyway I can remove the tags?

    Thanks

Viewing 1 replies (of 1 total)
  • Hello,

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

    You can modify the value of the adjacent links on your pages using some custom logic within this filter:

    /**
     * Allow the changing of link rel output by Rank Math.
     *
     * @param string $link The full <code><link</code> element.
     * $rel can be next or prev
     */
    add_filter( "rank_math/frontend/{$rel}_rel_link", function( $link ) {
     return $link;
    });
    

    Alternatively, you can disable this tag using the following code on your theme’s functions.php file:

    /**
     * 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' );

    Looking forward to helping you. 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 1 replies (of 1 total)

The ticket ‘Change/Remove Rel=Next & Rel=Prev’ is closed to new replies.