Documents Pane

By Simeon Griggs

Display the results of any GROQ Query inside a View Pane

sanity-plugin-documents-pane

Display a GROQ-queried list of Documents in a View Pane.

Incoming References

Installation

sanity install documents-pane

This plugin is designed to be used as a Component inside of a View.

The example below illustrates using the current Document being used to query for all Documents that reference it.

// ./src/deskStructure.js
import DocumentsPane from 'sanity-plugin-documents-pane'

// ...all other list items

S.view
  .component(DocumentsPane)
  .options({
    query: `*[!(_id in path("drafts.**")) && references($id)]`,
    params: { id: `_id` },
    useDraft: false
  })
  .title('Incoming References')

The .options() configuration works as follows:

  • query (string, required)
  • params (object, optional) A dot-notated string from the document object to a field, to use as variables in the query.
  • useDraft (bool, optional, default: false) When populating the params values, it will use the published version of the document by default.

License

MIT © Simeon Griggs See LICENSE

Install command

sanity install documents-pane

Contributor

Simeon Griggs

🇦🇺 in 🇬🇧 – Solution Engineer @ Sanity

Simeon is located at Newcastle upon Tyne, UK
Visit Simeon Griggs's profile

Other plugins by author

Iframe Pane

Display any URL in a View Pane, along with helpful buttons to Copy the URL or open in a new tab.

Simeon Griggs
Go to Iframe Pane

SEO Pane

Run yoast.js analysis on your front end, refreshing as you edit your Document, from inside a View Pane.

Simeon Griggs
Go to SEO Pane

Quick Fields Helper Function

Writing Sanity Schema can get verbose and repetitive. Quick Fields is a helper function with sensible defaults to tidy up schema files.

Simeon Griggs
Go to Quick Fields Helper Function