babel
babel copied to clipboard
Add header chunk
To have a nice SEO working html header, we need
<link rel="alternate" hreflang="en" href="[[~[[BabelTranslation? &contextKey=`web`]]? &scheme=`http`]]" \/\>
<link rel="alternate" hreflang=de-default" href="[[~[[BabelTranslation? &contextKey=`de`]]? &scheme=`http`]]" />
*backticks replaced for markup reasons.
So we need a simple solution that places the current language and all available translations inside the header.
Header chunk including the current language
<link rel="alternate" hreflang="[[++cultureKey]]" href="[[~[[*id]]? &scheme=`full`]]" />
[[BabelLinks? &tpl=`hreflangTemplateChunk`]]
with hreflangTemplateChunk
<link rel="alternate" hreflang="[[+cultureKey]]" href="[[+url]]" />
Hreflang has no default value. We could use a system setting for that like
<link rel="alternate" hreflang="[[++hreflang]]" href="[[+url]]" />
So that you can put x-default into the context that should serve as default language. Babel does not provide the +hreflang placeholder, so only ++hreflang would work. Only, if the current page is in the default language.
@mikrobi mind to add @Gallenkamp as collaborator or wiki editor? (I don't have permission to change this).
@goldsky done! Welcome onboard @Gallenkamp! 🎉
ha! didn't realize that you both are in germany. lol. go ahead @Gallenkamp , add https://github.com/mikrobi/babel/issues/153 to wiki as well
🇩🇪
are there any news on this? did someone worked out a solution for language headers?