Support » Plugin: Multisite Language Switcher » Is it possible to set x-default when using Multisite language switcher?

  • leguanx

    (@leguanx)


    Hello,

    I have my site in three languages:
    isabella-hansmann.com
    isabella-hansmann.com/en
    isabella-hansmann.com/es

    I would like to set an x-default for isabella-hansmann.com/en

    Is there any possibility to do that? I could not find any possibility to do that yet.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    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?

    Thread Starter leguanx

    (@leguanx)

    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/&#8221; title=”DE ” />
    <link rel=”alternate” hreflang=”en” href=”https://isabella-hansmann.com/en/&#8221; title=”EN ” />
    <link rel=”alternate” hreflang=”es” href=”https://isabella-hansmann.com/es/&#8221; 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.

    Plugin Author Dennis Ploetner

    (@realloc)

    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

    Thread Starter leguanx

    (@leguanx)

    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?

    Plugin Author Dennis Ploetner

    (@realloc)

    Yiu need probably additional logic inside the Mslsoutput class … PRs are welcome.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.