Local month name in Jekyll GitHub site

Jekyll on GitHub does not allow you to set local dates. But there is a solution to localize your date settings.

GitHub is a great place to create your own site with Jekyll. But when you host your site with Jekyll on GitHub you do not have all possibilities that Jekyll has. As a Dutch guy with Dutch sites I did not want the date to show up in an English way, so I wrote a little piece of code to show the Dutch month names.

GitHub & Jekyll

As you might know, or don’t know GitHub as a feature called Pages. With pages you can Setup your own GitHub site together with Jekyll. GitHub is a web-based hosting service version control using Git. It is mostly used for computer code. Jekyll is a simple blog-aware static site generator for personal, project, or organization sites. Now these two are a great combination to setup your site fast, easily and with markdown files a nice way to create and update site pages and blog items. Not only is this combination fast but also reliable and greatly appreciated by Google Search.

GitHub shortcomings

Now, publishing on GitHub using Jekyll is great…. but there are some shortcomings. To keep everything reliable GitHub only allows a certain amount of Plugins and you cannot set some settings like Local information.

Default GitHub Jekyll plugins

There are some plugins you can use, like sitemap, SEO, pagination, gist but there are a lot more plugins that you unfortunately cannot use.

Default plugins you can use are:

  • jekyll-coffeescript
  • jekyll-gist
  • jekyll-github-metadata
  • jekyll-paginate
  • jekyll-relative-links
  • jekyll-optional-front-matter
  • jekyll-readme-index
  • jekyll-default-layout
  • jekyll-titles-from-headings

And there are some extra plugins you have to put in your _config.yml file to work.

As you cannot use the language plugin there is no way to change the date easily.

But I have the solution for you.

GitHub Jekyll local month name solution

So to get this working you have to add the months to your _config.yml file and the rest to you post.html file or to a file where you need it:

{% capture i18n\_date %}
{% assign day = page.date | date: "%-d" %}
{% assign m = page.date | date: "%-m" | minus: 1 %}
{% assign month = site.months\[m\] %}
{% assign year = page.date | date: "%Y" %}
{% assign datum = day | append: " " | append: month | append: " " | append: year %}
{% endcapture %}

Dit is de datum {{ datum }}

Ghostboard pixel

Did you find this article valuable?

Support Theo van der Sluijs by becoming a sponsor. Any amount is appreciated!