I want to do a scheduled post.
I’m using gatsby.js, stradi and graphQL.
I am creating a blog.
I’d like to do a scheduled post, but
I don’t know how to do that.
I want to do a scheduled post.
I’m using gatsby.js, stradi and graphQL.
I am creating a blog.
I’d like to do a scheduled post, but
I don’t know how to do that.
Hey there!
If you’re using gatsby and the site is a blog, then i’m assuming all pages are statically generated (instead of fetching blog post content dynamically client-side, which isn’t good for SEO). Is this correct?
If so, I think you can achieve this by using cron tasks in Strapi. Something like what’s described here:
scheduled_at
to your Posts
collection.scheduled_at
is less than or equal the current datetime. e.g.:const postsToPublish = await strapi.services.post.find({ published_at_null: false, scheduled_at_lte: new Date() });
if (postsToPublish?.length > 0) {
await triggerGatsbyBuildWebhook()
}
This is one way of doing it. The other way is to use Strapi’s built-in webhook feature in the Admin UI, however it’s a bit limited out-of-the-box in terms of controlling when the webhook is triggered.
By the way, we’ve just updated this guide to Strapi v4.