How to disable the document action "duplicate" in Sanity.io

2 replies
Last updated: Sep 11, 2023
Is it possible to disable the document action "duplicate" ?
Sep 11, 2023, 12:28 PM
Yes, in your
sanity.config
you can filter the
prev
array that’s passed into your function. Here is an example of replacing one that can get you started.
Sep 11, 2023, 4:04 PM
Thanks.

  document: {
    actions: (prev) =>
      prev.map((originalAction) =>
        originalAction.action === 'duplicate' ? () => null : originalAction
      ),
  },
did the trick
Sep 11, 2023, 9:39 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?