Any idea how I can get something like this working?
The logic is that I know I only have 4 languages with corresponding domain aliases -- Since this original code from Milan Lund IS working but just not when I have separate domains set (it works great IF I use the subdirectory language approach like domain.com/en-US/ instead of englishdomain.com etc.) I figured I could try and just CHECK the returned language code and then use that to set a culture domain variable myself that I could then print into the <'link rel'> tag as needed.
The code below is not outputting anything, it's silently erroring out -- any ideas?
{% foreach (page in CurrentDocument.CultureVersions) {
string CultureDomain = "https://NoSet.com";
if (page.DocumentCulture == "en-GB"){
string CultureDomain = "https://GreatBritain.com";
}
else if (page.DocumentCulture == "en-AU"){
string CultureDomain = "https://Australia.com";
}
else if (page.DocumentCulture == "en-US"){
string CultureDomain = "https://USA.com";
}
else if (page.DocumentCulture == "en-IN"){
string CultureDomain = "https://India.com";
}
else {
string CultureDomain = "https://NoSet.com";
}
"<#link rel=\"alternate\" href=\""+ CultureDomain + "\" hreflang=\""+ page.DocumentCulture +"\" />"
}
|(identity)GlobalAdministrator%}
(Please note that Extra "#" at the beginning of the LINK REL tag is NOT there in my code, I just had to add it so this editor would stop hiding it from my response).