My Jekyll website is designed to allow for future posts and this has always worked until this week. I do not know if this is related to the new Jekyll updates, @ashmaroli?
I have not modified my code other than updating to the new version of Jekyll 4.3.1
.
Here is how the date is formatted (and has always been formatted) in the front matter for my future post:
---
(front matter stuff like layout, title, etc)
date: 2022-11-01
---
Today is October 31, 2022 so this post should not display.
However, if I display the site time with:
site time: {{site.time}}
The result is:
site time: 2022-11-01 01:29:14 +0000
And here is a screenshot from my computer’s clock:
The code I use to prevent displaying future posts looks like this:
{%- assign posts = site.posts
| where_exp: 'post', 'post.date <= site.time'
| where_exp: 'post', 'post.guest-details != nil'-%}
I am thinking the 4.3.0
update included some changes as documented here:
However, I am unsure as to what I should do to fix my code.
In my mind this feels like a bug because I am using Jekyll to handle dates the way I have for years. However, if I need to change my code, could someone please provide some support?
I need the code to run locally and also recognize the time while running in a GitHub Action.
If it is useful, here is my GitHub repo for the site in question:
And here is the post in question (which when you are reading this might not be a future date):
Note: I do understand that I can be very specific with dates (eg not just typing 2022-11-01
), I am using Forestry as a headless CRM and that is the date it puts into the field. I am sure I can add more granularity, but I am concerned about Jekyll not thinking today is really today.
Thanks