Is there an easy way of clearing unwanted published items?
Looking at your data, you have two documents of type siteSettings with different _id values:
"932ebb41-cf8d-463d-9ad9-6e4c88588b54"(created first)"siteSettings"(created later)
This is a common issue when setting up singleton documents - you've accidentally created multiple instances of what should be a single-instance document type.
To fix this, you need to delete the duplicate document. Here's how:
Go to your Sanity Studio and navigate to Vision (the query tool)
Run this query to verify which document you want to keep:
*[_type == "siteSettings"]Delete the unwanted document (likely the first one with the UUID). You can do this by:
- Finding it in your Studio content list and deleting it manually, OR
- Using the Vision tool with this mutation:
// Delete by ID sanity.delete('932ebb41-cf8d-463d-9ad9-6e4c88588b54')
Based on your data, you probably want to keep the second one (_id: "siteSettings") since it has your actual content (name: "Amy", website, etc.) and delete the first one.
To prevent this from happening again, configure your siteSettings as a proper singleton in your sanity.config.ts:
export default defineConfig({
// ... other config
schema: {
types: schemaTypes,
templates: (templates) =>
templates.filter(({ schemaType }) => schemaType !== 'siteSettings')
},
document: {
actions: (input, context) =>
context.schemaType === 'siteSettings'
? input.filter(({ action }) => !['duplicate', 'delete', 'unpublish'].includes(action))
: input
}
})This prevents creating additional instances through the "New document" menu and removes dangerous actions like duplicate/delete from the singleton document.
Show original thread5 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.