Visual Editing

Create Studio edit intent links

Learn how to construct URLs that open specific documents and fields in Sanity Studio for custom editorial interfaces and preview environments.

Edit intent links are URLs that open specific documents and fields in Sanity Studio. They are useful for building custom editorial interfaces or adding edit buttons to your preview environments.

When combined with Content Source Maps or steganography, you can automatically generate these URLs based on source map data for fully automated visual editing experiences. This article covers the manual approach for cases where you need direct control over the links.

Edit intent URL format

The basic format for an edit intent URL is:

Constructing edit URLs programmatically

You can construct edit intent URLs programmatically. The following helper function builds URLs for documents, specific fields, and nested field paths:

Adding edit buttons to a preview interface

You can use edit intent URLs to add edit buttons to your preview interface. Here are examples for document-level and field-level edit links:

Related resources

Was this page helpful?