Get today date in Jekyll with liquid markings

This (should) be easy, I think, but I can't get today's date to display on the Jekyll page using Liquid markup. According to the documentation , I would have to do this to get this year:

{{ 'now' | date: "%Y" }} 

But all that the rendering gets is the now line, not any formatted date. What am I doing wrong?

+55
ruby datetime jekyll liquid
Sep 17 '12 at 17:53
source share
2 answers

That didn't work either. It looks like you are in the current bug in Ruby 1.9.3 support. There is a pull request that fixes the error, but not yet included. The workaround is indicated, maybe it will work for you:

 {{ site.time | date: '%y' }} 
+106
Sep 17 '12 at 20:05
source share

To get the whole year, for example "2015" , from site.time you can use:

 {{ site.time | date: '%Y' }} # OR 20{{ site.time | date: '%y' }} 

To just get the last 2 digits from 2015, this will lead to the output of "15" :

 {{ site.time | date: '%y' }} 
+6
Dec 03 '15 at 15:50
source share



All Articles