New release: Conditional Fields

Documents Pane

By Simeon Griggs & Victoria Bergquist

Display the results of any GROQ Query inside a View Pane

sanity-plugin-documents-pane

Displays the results of a GROQ query in a View Pane. With the ability to use field values in the current document as query parameters.

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,
    debug: true,
  })
  .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.
  • debug (bool, optional, default: false) In case of an error or the query returning no documents, setting to true will display the query and params that were used.

License

MIT © Simeon Griggs See LICENSE

Install command

sanity install documents-pane

Contributors

Categorized in

Other plugins by authors

Content Calendar
- has 9 likes

Official(made by Sanity team)

Schedule and view your editorial calendar, right where you store your content. Prioritize and get organized on the fly with a visual calendar in your Studio.

Go to Content Calendar

Mux input

Upload videos to Mux directly from the studio.

Go to Mux input

MonkeyLearn Pane

Send the contents of a Portable Text field to MonkeyLearn's API to extract insights with the power of Machine Learning!

Simeon Griggs
Go to MonkeyLearn Pane