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.

Hi, folks. I’ve started using the term “released” to refer to “listed” posts. I “release” a post when I’m ready to publicize it (welcome page, archives, RSS), but I need to publish the post in order to schedule a tweet with Buffer.

I intend to build this as a Jekyll plugin, but I have little experience there, so I’m looking for advice on which kind of plugin to use. I presume that I’d write a Generator. Should I make it something else?

Perhaps I haven’t understood the problem you’re still facing given the fact that you have a front matter named released in such posts, but you can avoid writing a Ruby plugin entirely and instead depending on just Liquid:

{% for post in site.posts %}
  {% if post.released %}
    <li><a href="{{ post.url }}">{{ post.title }}</a></li>
  {% endif %}
{% endfor %}

No, that’s not all that I need. I want posts to become released in the future, which means that I will not add “released: true” to the front matter “by hand”. I can see two basic options:

  1. Run a build step that adds “released: true” to every post when the post’s publication date is reached. (I could then name the publication date to the “release date”).

  2. Add a Jekyll plugin that computes “released” based on the publication date.

I’m not sure which I prefer to do. Either I add a Jekyll command or a Jekyll generator/tag. I’m open to other suggestions that I can’t see.

Somewhat related is this thread that might give you some more ideas on how to automate using GItHub actions or cron jobs.

1 Like

My final intent is to have a similar process - write an article, schedule it for a future date, date triggered, article published, tweet with content from data file. I haven’t looked into the last part yet, though I am writing a PowerShell module for Twitter (the ones currently available do not suit my needs). I will most likely replace this GutHub action with one that uses PowerShell. Also, it would be nice to have additional social media targets, like LinkedIn and Reddit.

Thank you. I use Gitlab and not Github, but I imagine I could do something similar there. Now it becomes a question of whether I’d rather make this a build-time decision (scheduled job that releases posts by changing the front matter) or a run-time decision (compute which posts are released based on metadata). I think I prefer the run-time decision.

This is why I use Buffer: to schedule posts to Facebook, Twitter, and LinkedIn. In order for the nice Twitter card feature to work, the post must be published when I schedule the post, instead of when Buffer posts on my behalf. That’s what got me into this situation in the first place.

I suppose I could take Buffer out of the equation entirely and that might help, but then I don’t know what else to use and I don’t feel eager to sift through 30 lists of “alternatives to Buffer” which amount mostly to annoying advertising.

I’m pretty sure Twitter and Facebook can rescrape a link. Meaning if you post a link that doesn’t have Twitter card or OpenGraph meta content at the time of posting, and you add those later, they will eventually rescrape and update the tweet or FB post with appropriate meta content (image, description, etc.)

I know for a fact that OG’s debugger tool lets you trigger it. I think Twitter does the same when using their Twitter Card validation tool.

Thanks! The last time I tried this (with Buffer), it didn’t work as I’d expected, but I could always try it again!