Here is a tip to make a multilingual site using Liquid templates and Jekyll relatively easily and with few duplications.

I will be giving examples from my own experience for

Start by specifying the language in YAML Front Matter using a custom tag like lang:

    layout: default
    title: Projelerim
    lang: tr

Here lang is just a custom tag which we can make use via page.lang variable from within our pages.

Next, change your _layouts/ and _includes/ to be multilingual using simple case statements:

    <h3>{% case page.lang %}{% when 'tr' %}Etiket Bulutu{% else %}Tag Cloud{% endcase %}</h3>

Make note of the else statements which we use to specify a default language. So pages without the lang tag will be in English.

That’s all!

For more information, feel free to play with the source code of my blog:

Now I’ll be writing a Turkish translation of this post and see if it works :)

Note to self: writing literal Liquid inside Liquid requires some weird syntax mentioned here.