I have a small Jekyll-powered site that uses the default Liquid templating engine. I'm converting it to use Gekyll, which overrides the standard page.date
template variable with a Git timestamp, so I need to override the date with a page.original_date
value declared in the front matter just for older posts.
In my template, I'd like to be able to do this:
<span class="date">{% page.original_date or page.date | date: "%B %-d, %Y" }}</span>
That doesn't appear to work, so I'm doing this:
<span class="date">
{% if page.original_date %}
{{ page.original_date | date: "%B %-d, %Y" }}
{% else %}
{{ page.date | date: "%B %-d, %Y" }}
{% endif %}
</span>
It's not a big deal, but cumbersome enough to look for a better solution. Does the logic in Liquid allow for a fallback variable like in my first attempt?