Developer forum

Forum » Swift » hreflang support in Swift 2

hreflang support in Swift 2

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I am a bit confused about the rendering of hreflang meta tags for multi-language setups.
I don't see a specific meta tag definition in Swift-v2_Master (although the official Chat bot on the website claims that it should be), which is why I assume it would be rendered using the  @Model.MetaTags in Master page.
I am just confused if the rendering is triggered by a specific setup of the website and language layers.
Can anybody help me clarify this topic?
Thank you,
Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Anybody?

 
Lisa Bach Jensen Dynamicweb Employee
Lisa Bach Jensen
Reply

Hi Adrian,
I see that we are not yet supporting this in Swift 2.
We now have the extension method available from the backend, so we will make sure to add this. Expected in the next Swift version.
You can use it yourself in the meantime by adding it to your master template's <head>, right next to @Model.MetaTags:

@Model.GetHreflangLinks()

A few things to be aware of:

  • Each language needs a Primary host configured.
  • If you want a specific format (full culture vs. language-only in the hreflang attribute), you can pass a mode, e.g. Model.GetHreflangLinks(HrefLanguageMode.LanguageOnly) — the default is mixed.
    • Mixed (default): uses full culture only when multiple regions share the same language.
    • FullCulture: always outputs full culture code (e.g., de-de).
    • LanguageOnly: always outputs the short language code, e.g. en, da — even if you have multiple regional variants, so use this only if you don't need to distinguish between them.
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Lisa,
Thank you very much.
I was a bit confused after I found the Model.GetHreflangLinks in the source code, but no use of it in front-end :)

I will include it manually in my template.

Thank you,
Adrian

 

You must be logged in to post in the forum