Problem prev & next languages

#886871
  • Resolved IMK
    Rank Math free

    Hello,

    I have a problem with the rel and prev in the URLs with english or french language.

    <link rel="canonical" href="https://www.maincer.es/en/actualidad/page/3/" />
    <link rel="prev" href="https://www.maincer.es/actualidad/page/2/" />
    <link rel="next" href="https://www.maincer.es/actualidad/page/4/" />

    As you can see in the code, in the prev and next URLs do not have the language prefix /en/ or any other.

    Is there a way to fix this?

    I am using the following code, but it completely removes the link rel=“prev” and rel=“next”.

    The code i am using: https://pastebin.com/H4RjkL1j

    Regards

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

    We apologize for the issue you are facing with the rel="prev" and rel="next" links not including the language prefix in your URLs. This can indeed affect how search engines interpret your paginated content.

    To ensure that the language prefix is included in the prev and next links, you may need to adjust your code to properly handle the language settings. Unfortunately, we cannot provide specific code modifications without seeing the exact implementation details.

    However, we recommend checking the following:

    1. Ensure that your multilingual plugin (like WPML or Polylang) is correctly configured to handle pagination with language prefixes.
    2. Review the code you are using to ensure it correctly appends the language slug to the URLs.

    If you continue to experience issues, please reply to this ticket with more details about your setup, and a human agent from the Rank Math Support team will assist you further. Thank you for raising this concern!

    Hello,

    Thank you for contacting us. We apologize for any inconvenience this issue may have caused.

    The links in the next and prev rel tags can be modified using the following filter: https://rankmath.com/kb/filters-hooks-api-developer/#change-adjacent-link-output

    You would need to add a filter for each option (next and prev) and perform the necessary checks and modifications using PHP to get the actual correct pages.

    Looking forward to helping you.

    IMK
    Rank Math free

    Finally we have found the solution.

    I’m sharing the code in case someone can help you.

    https://pastelink.net/f5yiru2e

    Regards

    Hello,

    Thank you for sharing the solution! We’re glad to hear the issue is resolved. We’ll keep this code in mind for future reference in case it helps other users.

    Feel free to reach out if you need further assistance.

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

The ticket ‘Problem prev & next languages’ is closed to new replies.