babel icon indicating copy to clipboard operation
babel copied to clipboard

Add header chunk

Open Gallenkamp opened this issue 8 years ago • 7 comments

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.

MODX forums post on this

So we need a simple solution that places the current language and all available translations inside the header.

Gallenkamp avatar Jan 24 '17 07:01 Gallenkamp

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]]" />

Gallenkamp avatar Jan 24 '17 08:01 Gallenkamp

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.

Gallenkamp avatar Jan 24 '17 08:01 Gallenkamp

@mikrobi mind to add @Gallenkamp as collaborator or wiki editor? (I don't have permission to change this).

goldsky avatar Jan 24 '17 11:01 goldsky

@goldsky done! Welcome onboard @Gallenkamp! 🎉

mikrobi avatar Jan 24 '17 13:01 mikrobi

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

goldsky avatar Jan 24 '17 15:01 goldsky

🇩🇪

mikrobi avatar Jan 24 '17 17:01 mikrobi

are there any news on this? did someone worked out a solution for language headers?

degoya avatar Jul 26 '17 09:07 degoya