kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
925 stars 202 forks source link

Feature request: automatical adding correct hreflang to the pages #94

Open Etua opened 7 years ago

Etua commented 7 years ago

hreflang is used by search engines to define language of the particular site, so adding it to every generated page will improve it's SEO.

MPJHorner commented 6 years ago

👍 Great idea!

Any dev picking this up, best reference here https://moz.com/learn/seo/hreflang-tag

bbbenji commented 5 years ago

Why not just put this into the <head>?

{% capture link1 %}{{ site.baseurl_root }}{{ page.url}}{% endcapture %}
<link rel="alternate" href="{{ link1 }}" hreflang="en-us" />
{% capture link2 %}{{ site.baseurl_root }}pl{{ page.url  }}{% endcapture %}
<link rel="alternate" href="{{ link2 }}" hreflang="pl-pl" />
Nowaker commented 5 years ago

The solution provided by @bbbenji is probably okay, but the best solution would be to iterate through config's languages rather than hardcode languages into templates.