在Jekyll获取今天的日期与液体标记 [英] Get today's date in Jekyll with Liquid markup

查看:168
本文介绍了在Jekyll获取今天的日期与液体标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个(应该)很简单,我想,但是我无法使用Liquid标记在Jekyll页面中显示今天的日期。根据文档,我应该可以这样做来获得这个日期年:

This (should) be easy, I think, but I'm unable to get today's date to show in a Jekyll page using Liquid markup. According to the documentation, I should be able to do this to get this date's year:

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

但是所有渲染的是字符串现在,不是任何格式化的日期。我做错了什么?

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

推荐答案

这对我也没有用。看来,您已经在Ruby 1.9.3支持中遇到了当前的错误。有一个提取请求来修复该错误,但尚未被纳入其中。列出了一个解决办法,也许这将适用于您:

It didn't work for me either. It appears you've hit a current bug in the Ruby 1.9.3 support. There is a pull request that fixes the bug, but it's not incorporated yet. A workaround is listed, perhaps it will work for you:

{{ site.time | date: '%y' }}

这篇关于在Jekyll获取今天的日期与液体标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆