πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Can the "Publish" button text be changed to "Save" in Sanity.io?

6 replies
Last updated: Jun 21, 2023
Change the "Publish" button text to "Save"??Any quick tips on how to?
Jun 21, 2023, 7:57 PM
Hey (Removed Name),
I don't think that it's possible at this time, as it looks like
Publish
is hardcoded .
Jun 21, 2023, 9:18 PM
Ah that's a shame!
Our problem is that we have to manually trigger a build with getStaticProps (next.js), so "publish" in sanity is a bit misleading for our users
πŸ€·β€β™‚οΈ
Hoping this might change in the future!
Jun 21, 2023, 9:21 PM
Ahh, I understand. Sorry about that! I will definitely pass this along, as we've had a few similar requests recently.
Jun 21, 2023, 9:23 PM
Thanks a bunch, and great to hear we're not alone!
Jun 21, 2023, 9:29 PM
Hey (Removed Name), I passed it along, and I stand corrected!
It is possible to make this change, and I received this snippet:


function renamePublishAction(originalPublishAction) {
  return (props) => {
    const originalResult = originalPublishAction(props);
    return {
      ...originalResult,
      label: 'Save',
    };
  };
}

// ...

export default defineConfig({
  actions: (prev) =>
    prev.map((originalAction) =>
      originalAction.action === 'publish' ? renamePublishAction(originalAction) : originalAction
    ),
  // ... rest of config ...
});
Jun 21, 2023, 9:30 PM
Haha! Great news!!
Tried it and works great, with this little edit (
actions
goes in
document
):
export default defineConfig({
  document: {
    actions: (prev) =>
      prev.map((originalAction) =>
        originalAction.action === 'publish' ? renamePublishAction(originalAction) : originalAction
      ),
  },

  // ...rest of config
})
Jun 21, 2023, 9:35 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?