Skip to content

sanity-io/sanity-plugin-scheduled-publishing

Repository files navigation

Important

As of v3.39.0 of Sanity Studio, this plugin has been deprecated and the Scheduled Publishing functionality has been moved into the core studio package. Read more and learn how to update your configuration in the Sanity docs.

Original README preserved here


Migrate

Remove plugin config

Upgrade Sanity and run the following command in your project root to uninstall the plugin:

npm install sanity@latest
npm uninstall @sanity/scheduled-publishing

Next, remove the plugin from your studio configuration. Typically you'll find this in ./sanity.config.ts|js. Find and delete the following lines from your configuration:

// ./sanity.config.ts|js

-import {scheduledPublishing} from '@sanity/scheduled-publishing'

export default defineConfig({
  // ...
  plugins: [
-    scheduledPublishing()
  ],
})

Your plugin declaration might be a bit more expansive if you've defined a custom time format for the plugin. Delete it all!

// ./sanity.config.ts|js

import {scheduledPublishing} from '@sanity/scheduled-publishing'

export default defineConfig({
  // ...
  plugins: [
-    scheduledPublishing({
-      inputDateTimeFormat: 'MM/dd/yyyy h:mm a',
-    }),
  ],
})

Add new configuration for Scheduled Publishing

Note that while very similar to the plugin config this goes into the top-level of your studio configuration. Setting enabled to false will opt you out of using scheduled publishing for the project.

// ./sanity.config.ts|js

+ import {defineConfig} from 'sanity'

defineConfig({
  // ....
+  scheduledPublishing: {
+    enabled: true,
+    inputDateTimeFormat: 'MM/dd/yyyy h:mm a',
+  }
)

As before, you can add a custom time format if you so wish. If left unspecified, the format will default to dd/MM/yyyy HH:mm.

Document actions and badges

They are now exported from sanity

-import {ScheduleAction, ScheduledBadge} from '@sanity/scheduled-publishing'
+ import {ScheduleAction, ScheduledBadge} from 'sanity'