Locale specific date in jekyll

date-formatting, jekyll, liquid

Solution

You can overwrite the current month by using Liquid Date Format:

{% assign m = page.date | date: "%-m" %}
{{ page.date | date: "%-d" }}
{% case m %}
  {% when '1' %}Januar
  {% when '2' %}Februar
  {% when '3' %}März
  {% when '4' %}April
  {% when '5' %}Mai
  {% when '6' %}Juni
  {% when '7' %}Juli
  {% when '8' %}August
  {% when '9' %}September
  {% when '10' %}Oktober
  {% when '11' %}November
  {% when '12' %}Dezember
{% endcase %}
{{ page.date | date: "%Y" }}

If your date is, for example 2015-02-20, the output will be `20 Februar 2015`

Problem

I am trying out jekyll for website creation. I am using jekyll-bootstrap. The default configuration has the page archive, where all the posts are listed grouped by year and month of the post date. Currently the months appear in English. I've looked at the code and this is an excerpt which is responsible for putting the date: ``` {% capture this_month %}{{ post.date | date: "%B" }}{% endcapture %} ``` I've found a lot of information here, so there is a way to specify the desired locale. But how can you make jekyll respect it? Simply adding ``` default_locale: "lt" ``` in `_config.yml` naturally does not work.

Original source