Register now - Learn how Tecovas roped in success with Sanity and Shopify 🤠
November 15, 2023 (Updated November 16, 2023)

Use Comments for authors and editors

By Marco Spinello

Streamline your editorial workflow: use comments to manage asynchronous collaborative reviews and publish your content without leaving the studio. Less time and friction, more focus and content that shines.

Audience: content authors, reviewers, and editors

Goal

This guide walks content authors, editors, and reviewers through using comments in Sanity Studio for asynchronous collaboration: create, edit, share, and reply to comments. Mention other users in the comments. Resolve, reopen, and delete comments.

Access comments

First, can all participants—authors, editors, stakeholders—access commenting in a project or in a document?

User access to comments relies on the Sanity access control mechanism and on roles:

  • To add comments and replies to a document, users need a contributor role for drafts, or an editor role for drafts and published documents.
  • The parent document’s access permissions depend on the role and content resource settings for the project the document is part of.
  • At the project level, you can control user access through roles and by configuring project datasets to be public or private.

In a document, it’s possible to show or hide specific input fields to control user access to selected areas of the document when they view or edit it in the studio. If these fields have comments, users can view them only if they have the required permissions to access the input fields.

View comments

You can view and interact with comments in the comment pane of the active document.

To open the comment pane, click the Comments button in the top-right corner of the studio Structure (previously Desk) tool to open and close the comment pane:

Click the Comments icon to add a new comment and to open the comment pane.

The comment pane shows all the comments related to the active document. Comments are grouped based on the document fields they refer to and are sorted in reverse chronological order (newest first.)

To go to the document field a comment refers to, click anywhere in the comment.

If you attach a comment to a nested field, the header that shows the name of the input field the comment is attached to uses breadcrumbs to show the nested path in the document form:

Breadcrumb navigation helps you locate comments attached to nested fields in the document structure.

This is an example of a commented document with the comment pane showing only open comments:

1. Click the Comments button to open and close the comment pane. 2. The comment pane shows all the comments related to the active document. 3. The comment pane features two views: Open comments and Resolved comments. 4. The name of the document field a set of comments refers to.

View open and resolved comments

The comment pane features two views: Open comments and Resolved comments:

  • Select Open comments to show only comments under discussion.
  • Select Resolved comments to show only comments that don’t need further discussion.

Create a comment

If you can edit a document, you can add comments to it.

To add a comment to a document:

  1. Go to the document field with the content you want to add a comment to.
  2. Click the comment icon above the field. If the icon isn’t visible, hover the pointer anywhere over the field.
  3. In the comment field, type the content of the comment. When you’re done, click the send icon to save the comment.
    Alternatively:
    - Press Enter to save the comment.
    - Press Shift + Enter to add a line break and a new line in the comment.
  4. In the Open comments view of the comment pane, the newly created comment is available under the field name it refers to.
Click the Add comment icon to add a new comment associated with the current document field.

Type the content of your message in the comment input field.

The newly created comment is listed under the name of the document field it refers to in the document pane.

Edit a comment

You can edit only the comments you author.

To edit an existing comment:

  1. Open the comment pane, and go to the comment you want to edit.
  2. Hover the pointer over the comment until the comment menu options are displayed.
  3. Click the kebab menu icon; from the drop-down menu, select Edit comment.
  4. Update the content of the comment, and then click the send icon to save it. Alternatively:
    • Press Enter to save the comment.
    • Press Shift + Enter to add a line break and a new line in the comment.
Click the kebab menu icon and select Edit comment.

Reply to a comment

When multiple authors and editors work on the same document, they can interact asynchronously by creating and replying to comments. For example, this process can drive content reviews and requests for feedback.

To reply to a comment:

  1. Open the comment pane, and go to the comment you want to reply to.
  2. In the original comment, click Reply.
  3. In the new comment field, enter your reply, and then click the send icon to save it. Alternatively:
    • Press Enter to save the comment.
    • Press Shift + Enter to add a line break and a new line in the comment.

The first reply to an existing comment automatically creates a thread, similar to apps such as Slack.

When you reply to a comment, the author of the comment you reply to receives an automated email notification.

Mention users

In a collaborative context, you may need to pull in other authors and editors to contribute to a document with advice, suggestions, or feedback.

To mention a user:

  1. Create or reply to a comment.
  2. In the comment field, type @ to display a list of users whom you can mention. Alternatively, click the @ icon on the comment to display the user list. The list includes only existing users who have permission to comment on the current document.
  3. Select a user from the list, or start typing their username. Autocompletion helps you narrow down to pick just the right user you want to gently nudge.
  4. When you’re done, click the send icon to save the comment.

When you mention a user, they receive an automated email notification.

Share a comment

Each comment is assigned a URL upon creation. You can share the URL with other users to point them directly to the comment it refers to.

To get the comment URL:

  1. Open the comment pane, and go to the comment you want to share.
  2. Hover the pointer over the comment until the comment menu options are displayed.
  3. Click the kebab menu icon; from the drop-down menu, select Copy link to comment.
  4. The link is copied to your clipboard so that you can paste it into a chat, an email, or another document. When users click it, it opens the parent document in a new browser tab and highlights the target comment or thread in the comment pane.
Click the kebab menu icon and select Copt link to comment.

Resolve a comment

When any follow-up activities related to a comment are completed, you can mark the comment as resolved. You can resolve a comment; however, you can’t resolve individual replies to a comment in a thread. Replies are attached to the parent comment they refer to, and they inherit the same open or resolved state.

To resolve a comment:

  1. Open the Open comments view of the comment pane, and go to the comment you want to resolve.
  2. Hover the pointer over the comment until the comment menu options are displayed.
  3. Click the Mark as resolved icon.
  4. The comment is removed from the Open comments view, and it’s available in the Resolved comments view of the comment pane.
Click the Mark as resolved icon to resolve a comment.

Reopen a comment

You can reopen resolved comments. For example, because a requested follow-up activity has not yet been completed, or to double-check an issue.

To resolve a comment:

  1. Open the Resolved comments view of the comment pane, and go to the comment you want to reopen.
  2. Hover the pointer over the comment until the comment menu options are displayed.
  3. Click the Re-open icon.
  4. The comment is removed from the Resolved comments view, and it’s available in the Open comments view of the comment pane.
Click the Re-open icon to reopen a previously resolved comment.

Delete a comment

If you no longer need a comment or a reply to a comment, you can delete it. This is a destructive action, and it’s not possible to undo it.

To delete a comment or a reply to a comment:

  1. Open the comment pane, and go to the comment or the reply you want to delete.
  2. Hover the pointer over the comment or the reply until the kebab menu icon is displayed.
  3. Click the kebab menu icon; from the drop-down menu, select Delete comment.
  4. The comment or the reply is deleted from the document and from the add-on comment dataset it was stored in.

Click the kebab menu and select Delete comment.

Gotcha

If you delete content inside a nested document field, any comments that refer to it are hidden, and they’re no longer accessible in the comment pane. However, these comments aren’t deleted; they persist in the add-on comment dataset.

If a document field is removed from the document schema or is renamed, all associated comments are hidden in the studio GUI, but they’re still stored in the add-on comment dataset.

Further reading

Sanity – build remarkable experiences at scale

Sanity Composable Content Cloud is the headless CMS that gives you (and your team) a content backend to drive websites and applications with modern tooling. It offers a real-time editing environment for content creators that’s easy to configure but designed to be customized with JavaScript and React when needed. With the hosted document store, you query content freely and easily integrate with any framework or data source to distribute and enrich content.

Sanity scales from weekend projects to enterprise needs and is used by companies like Puma, AT&T, Burger King, Tata, and Figma.

Other guides by author