Wrong Canonicalization Multilanguages Site

#83285
  • Resolved APKMODY
    Rank Math free

    Hi,

    I use Polylang to create multi-languages in my site.

    The homepage for the second language has the wrong canonical URL.

    English: domain.com
    Vietnamese: domain.com/vi/ but canonical is domain.com

    Please help!

    Thank you.

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

    Thank you for contacting Rank Math today.

    Your translated URL Vietnamese: domain.com/vi/ is showing the correct canonical URL from my end. As for the translated pages, you can the original and translated pages in your page-sitemap since you are using the same domain translation. Please check the screenshots I have attached in the sensitive section for reference and let us know if you need further assistance.

    Looking forward to helping you. Thank you.

    ​​​​​​

    I use a custom canonical to fix that temporarily.

    You can setup Polylang and Rank Math to see that bug

    In the sitemap,

    the URL show domain.com/vi
    But it should be domain.com/vi/

    Thank you!

    Hello,

    Thank you for the follow up.

    The URLs are usually generated according to your permalink settings. Please head over to your WordPress Dashboard > Settings > Permalinks and change this to how you wish your settings to be.

    P.S: Even if you type any of the URLs on your browser with a slash at the end, WordPress will redirect them to without the slash automatically and vice versa

    Looking forward to helping you. Thank you.

    ​​​​​​

    You are not properly understanding my problems here.

    I will describe as closely as possible the current problems. I think this is a compatibility issue with Polylang. Polylang working fine with Yoast SEO.

    My site domain.com has 2 languages: English and Vietnamese.

    1. Vietnamese homepage has the wrong canonical.

    It should be domain.com/vi/, but it is showing domain.com. Now I use a temp fix by custom canonical from the post edit screen.

    2. Vietnamese homepage has the wrong URL in the sitemap.

    In the page-sitemap.xml, it is showing domain.com/vi but it should be domain.com/vi/

    3. Breadcrumb also incorrectly displays homepage URL.

    When I’m on a Vietnamese post, homepage URL should be: domain.com/vi/ but Rank Math shows domain.com here.

    You have to install Polylang to see all bugs.

    • This reply was modified 4 years, 2 months ago by APKMODY.

    Hello, anyone please see this case. Please help.

    • This reply was modified 4 years, 2 months ago by APKMODY.

    Mail to Polylang and this is their reply:

    The code below (also attached in a php file) should allow you to get the corresponding canonical:

    add_filter( ‘pll_home_url_white_list’, function( $arr ) {

    return array_merge( $arr, array( array( ‘file’ => ‘seo-by-rank-math’ ) ) );

    } );

    You can add in the functions.php of a child theme or in a custom plugin. Could you please contact the Rank Math team to foward them this code? They could be interested by integrate it in their code.

    Hello,

    Thank you for sharing that code.

    Did it work for you and is this issue resolved now?

    We have also noted this for improvement and if there is a way for us to implement this in the core, we will do that in a future update.

    Thank you. The code will fix almost. Only missing “/” at the end of Vietnamese URL.

    Hello,

    The Polylang team has added the compatibility for the Yoast plugin and we had asked them to do the same for Rank Math. Last year, we also submitted a PR in their repo but for some reason, they are not merging it.

    Here is a PR link: https://github.com/polylang/polylang/pull/373

    The PR also includes the code which their support team had provided.

    Please contact the PolyLang team and ask them to merge the code into their public plugin so that the issue can be fixed permanently.

    Hope that helps.

    Here’s what Polylang responded to my email, I hope this helps.

    In fact the Seo by Rank Math loads its options before the other plugins are fully loaded. It is much better to do nothing before all plugins are loaded (action ‘plugins_loaded’), otherwise you prevent other plugins such as Polylang but not only to hook into actions and filters. This prevents to load the translations done in the Strings Translations. Could you please contact them to report this problem so that they might look for a solution? Meanwhile you can use the attached mini plugin, it should allow to display the translations of this plugin made in the Strings Translations.

    Hello,

    Thank you for forwarding the email.

    Like other plugins, we don’t use the function to get the options data again and again. We get it only once and then we cache it. This is to improve performance.

    If they want to load certain options after the Polylang code is loaded, then they can use rank_math()->settings->reset(); code.

    We have offered help with that in the past but they are yet to reply to us and because of that – users like you have to suffer. We are extremely sorry about that but we wish we could help more but the truth of the matter is – this is something the Polylang team will need to fix.

    Can you create a mini plugin that fixes these errors?

    Alberto
    Rank Math business

    Hello,

    I am sorry but due to being a small team we are unable to do it (for now) but if you are going to implement it and you have questions, we will be more than happy helping you with it.

    Looking forward to help 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 14 replies - 1 through 14 (of 14 total)

The ticket ‘Wrong Canonicalization Multilanguages Site’ is closed to new replies.