Sanity: Improve post scheduling

Created on 2 Apr 2019  Â·  4Comments  Â·  Source: sanity-io/sanity

Is your feature request related to a problem? Please describe.
I'd like to be able to schedule entries for future publication, whilst retaining an intuitive edit / validation workflow.

This has been previously discussed on slack and the general consensus was to add a separate date field and ensure that the entry remains unpublished / as a draft. A separate scheduled task would then be created, sporadically publishing all draft entries where current date > entries' publish date.

My issue isn't so much needing to create a scheduled task to accomplish this, but more how this workflow negatively affects editing.

Assuming that you go with a separate date field, editors will need to know not to press the big 'publish' button when they're done with changes. Fundamentally, it feels really odd and quite unsafe to schedule a future post via a side effect (of changing the value in another field) without ever having to confirm that through a discrete button press.

Moreover, I think this behaviour could cause issues when Sanity introduces publish-time validation (especially with async operations) as editors wouldn't be able to take advantage of this with the current approach.

Describe the solution you'd like
Ideally (dreaming) – document schemas would interpret a reserved date field with the name publishDate and all instances of the 'Publish' button would then display 'Schedule' when this publishDate field is set in the future. Sanity would then take care of the scheduling magically behind the scenes and it'd just work™

Alternatively – there could be a way to able to allow the export / client API to not return certain entries if a condition is met. This condition could be defined at the schema level and would mean that the current, recommended way of scheduling entries would remain as-is, except that editors would now be able to hit that big Publish button after they've made changes – which not only feels more intuitive, but may also play better with publish-time validation down the track.

Additional context
All the above is all assuming a public dataset.

Feature Request

Most helpful comment

To follow up on how this would come in handy (at least in my specific use case):

Consider a custom calendar component which renders documents of different types in a single view.

Here, editors would be able to queue up and publish future content in confidence knowing that it's properly validated whilst also being able to easily see what is unfinished. In this instance, draft content is greyed out, other (published) entries are colour coded by document type.

image

I'm surprised how easy it was to add this custom component (and query content) in Sanity!

All 4 comments

To follow up on how this would come in handy (at least in my specific use case):

Consider a custom calendar component which renders documents of different types in a single view.

Here, editors would be able to queue up and publish future content in confidence knowing that it's properly validated whilst also being able to easily see what is unfinished. In this instance, draft content is greyed out, other (published) entries are colour coded by document type.

image

I'm surprised how easy it was to add this custom component (and query content) in Sanity!

Amazing! You should publish this as a plugin @robinpyon!

Displaying the original filename somewhere would be desirable also.

Would you say this is solved with the new custom workflows feature?

Was this page helpful?
0 / 5 - 0 ratings