Setting up alternate languages with subdomains

Samplified
Visitor
2 0 5

So, I've set up Weglot on my platform and translated it into two languages (German and Spanish). My TLD had to be .us which I don't think matters as much as I can translate and use subdomains to target specific countries.

My main domain and translations are as follows:

Now I'm trying to add subdomains to target specific countries. I.e

What I'm noticing for hreflang tags is the following. Home Page has 6 hreflang tags 3 for the default, US, and UK website/subdomain and 3 from Weglot.

 

<link rel="alternate" hreflang="x-default" href="https://website.us/">
<link rel="alternate" hreflang="en-US" href="https://website.us/">
<link rel="alternate" hreflang="en-GB" href="https://uk.website.us/">
<link rel="alternate" hreflang="en" href="https://website.us/">
<link rel="alternate" hreflang="de" href="https://de.website.us/">
<link rel="alternate" hreflang="es" href="https://es.website.us/">

 

Then when I'm checking the new UK subdomain the following hreflang tags. Essentially the UK subdomain should have the same ability to just switch between subdomains, but I'm not exactly sure if the weglot plugin is installed or working properly on this subdomain. It's pretty obvious it's not as I go to switch languages it doesn't actually switch to the correct subdomain. And you can see the de translation is de.uk. which isn't correct.

 

<link rel="alternate" hreflang="x-default" href="https://website.us/">
<link rel="alternate" hreflang="en-US" href="https://website.us/">
<link rel="alternate" hreflang="en-GB" href="https://uk.website.us/">
<link rel="alternate" hreflang="en" href="https://website.us/">
<link rel="alternate" hreflang="de" href="https://de.uk.website.us/">
<link rel="alternate" hreflang="es" href="https://es.website.us/">

 

Where do I even start with cleaning this up. Essentially I want targeted subdomains to countries, UK, CA, AU, JP, and maybe one more with the ability to translate between 3-4 languages. I have the ability to alter Weglot's JS Code to canonical properly, I'm just not too familiar with liquid. 

 

{%- assign full_url = canonical_url | split: '://www.' | last | split: '://' | last -%}
<link rel="alternate" hreflang="en" href="{{ canonical_url }}">
<link rel="alternate" hreflang="de" href="https://de.{{ full_url }}">
<link rel="alternate" hreflang="es" href="https://es.{{ full_url }}">
<link rel="alternate" hreflang="fr" href="https://fr.{{ full_url }}">
<script type="text/javascript" src="https://cdn.weglot.com/weglot.min.js"></script>
<script>
    Weglot.initialize({
        api_key: 'wg_61d81da950228f1b0e719bfa3a6504486'
    });
</script>

 

 

So essentially I want to have:

4-5 subdomains with 3-4 translation options for each. Weglot takes care of the main Germany, France, and Spain and creates subdomains. Then when I created a new subdomain uk.website.us and mapped the DNS this is where things got weird. Essentially the canonical URL logic pulls the entire URL for just de which I don't understand why it doesn't do that for es. as well. 

 

https://website.us (default)
uk.website.us (United Kingdom)
ca.website.us (Canada)
au.website.us (Austrailia)
de.website.us (Germany)
es.website.us (Spain)
fr.website.us (France)

 

 

Any help here is extremely appreciated. 

Replies 0 (0)