@indent-oss/sanityio-referenced-by
v0.1.4
Published
Plugin for viewing resources which reference a particular resource
Downloads
1,070
Readme
@indent-oss/sanityio-referenced-by
Plugin to see which documents reference a particular document
https://user-images.githubusercontent.com/31798108/173065472-95294be4-7fc1-4f19-ba6c-e313c67acbed.mov
Video Alt Text: Demonstration of the Referenced-by Plugin
Getting started
Have an existing Sanity.io Studio Project
Install
@indent-oss/sanityio-referenced-by
plugin using the command line:- NPM
npm i @indent-oss/sanityio-referenced-by
- Yarn
yarn add @indent-oss/sanityio-referenced-by
Add
@indent-oss/sanityio-referenced-by
tosanity.json
"plugins":
// /sanity.json
"plugins": [
"@indent-oss/sanityio-referenced-by"
],
- Add
sanity-structure.js
reference tosanity.json
"parts":
// /sanity.json
"parts": [
{
"name": "part:@sanity/desk-tool/structure",
"path": "./sanity-structure.js"
}
]
- Create and/or update
sanity-structure.js
in the root directory:
// /sanity-structure.js
import {ReferencedByView} from 'part:@indent-oss/sanityio-referenced-by'
import S from '@sanity/desk-tool/structure-builder'
export const getDefaultDocumentNode = () => {
return S.document().views([
S.view.form(),
S.view.component(ReferencedByView).title('Referenced by'),
])
}
export default () => S.list().title('Base').items(S.documentTypeListItems())
Please note that Sanity.io Studio requires a title
as a property of S
in the export default
function, but title does not need to be 'Base' for the plugin to work.
- Run the Sanity.io Studio Project - "Referenced By" plugin tab appears
The example
directory contains an example Sanity.io Studio project which has the @indent-oss/sanityio-referenced-by
plugin already installed
Credits
Thank you to Devin Halladay: List Referring Documents (Backlinks) in Sanity
License
MIT © Indent Inc