I've been using Liquid extensions to reformat dates on my Jekyll based site, for example:
<p>{{ post.date | date_to_string }}</p>
This works fine in my index.html
page which just takes the five most recent posts and then iterates them post by post. However, this fails when I am trying to render such a date within my _layouts/base.html
template.
I have tried:
{{ page.date | date_to_string }}
{{ page.title }}
works without issue, and {{ page.date}}
renders when I use it without the liquid filter, outputting, for example, 2012-03-12 00:00:00 +0000
.
Why does the date_to_string
filter fail with the input provided by {{ page.date }}
. I get the following error:
Liquid Exception: undefined method `strftime' for nil:NilClass in base
And the build fails. Thanks for any help!