سؤال

I want to make blog. I use jekyll and poole framework. And I want to localize my posts' dates.

{% for post in site.posts %}
  * {{ post.date | date_to_string }} » [ {{ post.title }} ]({{ post.url }})
{% endfor %}

And here is how I try to make localization:

{% for post in site.posts %}
  * {% assign m = page.date | date: "%-m" %}
  {{ page.date | date: "%-d" }}
    {% case m %}
      {% when '1' %}Января
      {% when '2' %}Февраля
      {% when '3' %}Марта
      {% when '4' %}Апреля
      {% when '5' %}Мая
      {% when '6' %}Июня
      {% when '7' %}Июля
      {% when '8' %}Августа
      {% when '9' %}Сентября
      {% when '10' %}Октября
      {% when '11' %}Ноября
      {% when '12' %}Декабря
    {% endcase %}
    {{ page.date | date: "%Y" }}
    » [ {{ post.title }} ]({{ post.url }})
{% endfor %}

I'm trying to make it according to http://alanwsmith.com/jekyll-liquid-date-formatting-examples (Outside U.S. Style with Non-English Full Month Name). But it does not work: dates just does not appear. How to fix it?

هل كانت مفيدة؟

المحلول

The problem was in page.date. It should be post.date.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top