SEO Recipes

Recipes for Search Engine Optimization using Polyglot

If you have installed the jekyll-polyglot gem, these additions to your site head can easily provide your jekyll blog with Google-powered SEO bonuses.

HTML Language Declaration

Per the WHATWG HTML Living Standard, you should declare the page language using the lang attribute on the root HTML element. Add this to your layout:

<html lang="{{ site.active_lang }}">

This enables browsers, search engines, and assistive technologies (screen readers, translation tools) to correctly process your content.

Multi-language SEO using hreflang alternate tags

You can easily add hreflang="tr" alternate tags to your site, achieving SEO with google multi-language searches. Fallback to the default language version of your site when the browser uses an unmatched language with hreflang="x-default"

Be sure to include canonical tags when identifying content on similar pages of the same language.

Add the following to your head:

{% if page.lang == site.default_lang %}
<link rel="canonical"
      href="http://yoursite.com{{page.permalink}}" />
{% else %}
<link rel="canonical"
      href="http://yoursite.com/{{page.lang}}{{page.permalink}}" />
{% endif %}
<link rel="alternate"
      hreflang="{{site.default_lang}}"
      href="http://yoursite.com{{page.permalink}}" />
<link rel="alternate"
      hreflang="x-default"
      href="http://yoursite.com{{page.permalink}}" />
{% for lang in site.languages %}
{% if lang == site.default_lang %}
  {% continue %}
{% endif %}
<link rel="alternate"
    hreflang="{{lang}}"
    href="http://yoursite.com/{{lang}}{{page.permalink}}" />
{% endfor %}

All of the above (hreflang and canonical)

You can get the canonical link, alternate hreflang links, and x-default fallback with a single tag added to your head.html:

{% I18n_Headers %}

Note: You should still add <html lang="tr"> to your layout’s root element separately, as described above.

With this SEO, each page click for one site’s language will count towards the net clicks of all languages on the website.

Other SEO best practices for polyglot

  <meta name="description" content="{{ page.description | default: site.description[site.active_lang] }}">
  <meta name="keywords" content="{{ page.keywords | default: site.keywords[site.active_lang] }}">