Publishing future posts, but not "listing" them

Hi, folks. I’m trying to fit Jekyll to my workflow for scheduling posts in the future. Yes, I know about the future switch and the future attribute of posts and about settings dates on posts. I want to combine two somewhat contradictory things that create confusion and I wanted to know whether I can do this without writing my own Liquid post filter.

I want to schedule a post in the future, then schedule a tweet with Buffer that promotes that post. I want Buffer to be able to use the nice Twitter card extras for that post, such as a featured image and a summary. I want to schedule that tweet now, which means that (is this true?!) I need to have already published the post on my Jekyll blog so that Buffer will find the necessary image and summary for the tweet that creates the nice-looking Twitter card.

If the post link isn’t live when I schedule the tweet, then I don’t get the nicey-nicey stuff, but rather a plain link to a post that will have been published by the time Buffer sends the tweet. Good, but not good enough.

Because of this, I need Jekyll to publish future posts. (I have configured that. Alternatives?) But I don’t want future posts to show up in post lists (examples: welcome page, archive, archive by category), so I have to filter future posts out of site.posts in order to be able to list them. Here is where I want a filter: I don’t see how to do “select all posts not in the future and take the 10 most recent” with the available Liquid/Jekyll features. I end up having to do this: “select all posts and take the 10 most recent”, then in the loop “if this post is not in the future…”. If I have 10 scheduled posts, then I would have ZERO posts on my welcome page. Disastrous!

So I would really like to be able to select all posts not in the future and take the 10 most recent. Can I do this with the pieces already available in Jekyll or do I need to write my own Liquid filter that does this query? I’m thinking of calling these posts “listed”/“unlisted”.


hmm, interesting use case. You want the post published so it is accessible by whatever Buffer is, yet you don’t want it to appear in the loop of posts.

I don’t think that it will work as is. I don’t think you can sort just non-future posts which is what it sounds like you want.

But I am not sure and there are several people on here much more clever than me so maybe they would have a way to do it.

Maybe you could assign all posts that have a date of today or older and then loop thru that to make your list of posts? and then future could be on, so the post would exist, but the loop would only iterate over today or older posts? So instead of take all posts and select the 10 most recent and then check, you would assign a new variable to equal all posts older than x and then loop thru the most recent 10? no idea if that is possible just thinking out loud.

Only way I can think of doing this is adding some sort of front matter flag to these “future dated/published/but listed posts” e.g. unlisted: true

The you can add some logic to your Liquid loop that lists all posts and only include those posts that are unlisted == false (Jekyll’s where filter should help here) which would omit them from post lists but still make them publishable and picked up by Buffer.

Though the scheduling part complicates thing as you’d need to remove the unlisted front matter or flip it to false at whatever date it was to be active.

Note, I’ve never used Buffer so not sure how it works with scheduling tweets. I’m assuming it tries to read opengraph and Twitter card metas when it first checks the URL, but do you know if it rescrapws at the time of publishing the tweet? If that’s the case then when your post is live it would be accessible to Buffer to grab the image, description, etc. and all would be well.

Thanks. Indeed, I could try to make it part of the “build” process to simply flip a “listed” flag from false to true for every post that’s timestamped before now. I keep forgetting about that possibility, so thank you for the reminder.

As for how Buffer works, I haven’t tested it extensively, but I believe it reads all those things when I schedule the posting, rather than when it publishes the posting. I’d have to test more to be sure. Indeed, if by chance Buffer behaves more conveniently, then the problem mostly goes away and it comes down to ensuring that Netlify publishes the article before Buffer publishes the tweet.