The x-default for a page is the page itself if there are no translations available. At least as far I understood it… MSLS does that already
https://github.com/lloc/Multisite-Language-Switcher/blob/d5747af1cb86d0a5ae34ad306fabc311b91195a6/includes/MslsOutput.php#L117-L119
Do you mean a canonical link?
Hello,
thank you for your reply.
I read that with the x-default I can indicate which page is the default page if there is no page in the language of the user. In the case of a french user for example I would like to indicate that isabella-hansmann.com/en is the default page. Correct me if I am wrong I do have only a superficial understanding of this topic.
In my header I found the following code which I believe is set by the Multisite Language Switcher
</script>
<link rel=”alternate” hreflang=”de” href=”https://isabella-hansmann.com/” title=”DE ” />
<link rel=”alternate” hreflang=”en” href=”https://isabella-hansmann.com/en/” title=”EN ” />
<link rel=”alternate” hreflang=”es” href=”https://isabella-hansmann.com/es/” title=”ES” />
In order to set the x-default for my English page, I need to change the hreflang to: hreflang=”x-default”
I tried to do this via FTP access in the header.php and with the plugin Header, Footer and Post Injections, but it did not work.
Thus either I am missing any detail (which is possible as this is very difficult for me) or I have to do it at a different place because I am using the Multisite Language Switcher.
I’d appreciate any hint or advise with this issue.
I’m sorry but it is not implemented in MSLS as you would like. Right now, you have an x-default when no translation available
view-source:https://lloc.de/wordpress-core-git-und-docker.html
and the other ones when a translation is in place:
view-source:https://lloc.de/msls
Thank you a lot for the information. That is great to know.
I’m also needing this at the moment, I will integrate the x-default manually via filter then.
But maybe it’s a good idea for a future update, to add a checkbox in the language settings screen, where you can set a specific language version as x-default and then this tag will automatically getting outputted besides the normal hreflang tag 🙂
Is it possible to use this action to add the x-default?
https://msls.co/developer-docs/snippets-examples.html#the-blog-collection
By saying if $blog->get_language() == “<my needed language”) and adding an additional link alternate tag? But how do I get the current url in this action? Wasn’t able to find it in the $blog variable at all, is it possible to access it inside this action?
Yiu need probably additional logic inside the Mslsoutput class … PRs are welcome.
Hi Dennis
According to ahrefs “Missing x-default” in every page I use Multisite Language Switcher.
Are you planning to have an option in the plugin?
Thanks