@rankwatecleoxor is it possible to edit the wpml-config.xml as follows:
<custom-field action="translate">rank_math_canonical_url</custom-field>
Also a check for the language part and trailing slash could be implemented to ensure the homepage URL has a correct canonical URL.
Hi Bastian,
Thanks for getting in touch with us today.
Could you please inspect the page source and check whether this issue affects the canonical links on the translated pages?
We are looking forward to helping you. Thank you.
Target (blank):
page A: canonical should be domain.com/de/
page B: canonical should be domain.com/en/
Actual (blank):
page A: canonical is domain.com
page B: canonical is domain.com
Target (filled):
page A and page B is the same.. so I type domain.com/de/ in canonical field for page A and page B takes the same value because in your wpml-config.xml on line 10 there is action="copy"
for rank_math_canonical_url
. This should be replaced with action="translate"
because the canonical URL must not be the same for two different languages.
So what I want:
1. make the canonical URL translateable (like mentioned above)
2. Use a trailing slash for the canonical URL on the homepage URL independent of multilingualism
3. Use the language parameters for the canonical URL on the homepage URL
Hi Bastian,
Thanks for the additional information.
I have submitted these suggestions to our dev team and we will be getting back to you in a short while to discuss this further.
We appreciate your patience. Thank you.
Hello Bastian Fießinger,
You can change the config.xml values from WPML settings. To do that, please install WPML’s Translation Management plugin and navigate to WPML >> Settings >> Custom Fields Translation and set rank_math_canonical_url to translate.
That should fix the issue.
Thank you.
@pratik-d I don’t have WPML installed.. The post is about polylang, which does not offer those settings. For this time I changed the value directly in RankMath which is not really secure for updates.
This should be fixed for all installations because the canonical URL can vary for different languages. Also what about the problem with the missing trailing slash (and lang parameters) on homepage canonicals?
Hello,
I am sorry for the confusion.
I’ve forwarded this issue to our Development team. They will further debug this and fix it in the upcoming updating.
We appreciate your patience. Thank you.
By the way: Yoast ignores this field completely (which might be an even better way to handle it, because no synchronisation takes affect ever)
Source: <custom-field action="ignore">_yoast_wpseo_canonical</custom-field>
Don’t get me wrong. I’m a big fan of your product and thats why I’m trying to collect as much bugs or disagreements as possible to make it even better.