{"id":51435696,"url":"https://github.com/flayks/sanity-plugin-references","last_synced_at":"2026-07-05T06:30:43.545Z","repository":{"id":367290778,"uuid":"1128051213","full_name":"flayks/sanity-plugin-references","owner":"flayks","description":"See which documents reference the current document in your Sanity Studio.","archived":false,"fork":false,"pushed_at":"2026-06-11T09:39:59.000Z","size":358,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-25T11:28:24.093Z","etag":null,"topics":["reference","referencedby","references","sanity","sanity-plugin","sanity-studio"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sanity-plugin-references","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flayks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"flayks","ko_fi":"flayks","buy_me_a_coffee":"flayks"}},"created_at":"2026-01-05T04:14:50.000Z","updated_at":"2026-06-11T09:40:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/flayks/sanity-plugin-references","commit_stats":null,"previous_names":["flayks/sanity-plugin-references"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/flayks/sanity-plugin-references","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flayks%2Fsanity-plugin-references","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flayks%2Fsanity-plugin-references/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flayks%2Fsanity-plugin-references/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flayks%2Fsanity-plugin-references/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flayks","download_url":"https://codeload.github.com/flayks/sanity-plugin-references/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flayks%2Fsanity-plugin-references/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35145900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reference","referencedby","references","sanity","sanity-plugin","sanity-studio"],"created_at":"2026-07-05T06:30:42.079Z","updated_at":"2026-07-05T06:30:43.483Z","avatar_url":"https://github.com/flayks.png","language":"TypeScript","funding_links":["https://github.com/sponsors/flayks","https://ko-fi.com/flayks","https://buymeacoffee.com/flayks"],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003e\n  🔗 References Plugin for Sanity 🔗\n\u003c/h2\u003e\n\u003cp align=\"center\"\u003e\n  See which documents reference the current document in your Sanity Studio.\u003cbr/\u003e\n  Displays a badge with the reference count and a custom pane with the full list.\n\u003c/p\u003e\n\n![screenshot](https://github.com/user-attachments/assets/5a2256a8-da35-4d9f-b0ca-8416aa87194d)\n\n## Features\n\n- **Reference Badge**: Shows count of documents referencing the current document\n- **References Tab**: Lists all referencing documents with:\n  - 🔍 **Search** by title or document type\n  - ⬇️ **Sorting** by updated date, type, or title (ascending/descending)\n  - 📊 **Live Count** of filtered vs total documents\n  - 🚀 **Click to Navigate** to any referencing document\n\n## Installation\n\n```sh\n# npm\nnpm i sanity-plugin-references\n\n# yarn\nyarn add sanity-plugin-references\n\n# pnpm\npnpm add sanity-plugin-references\n\n# bun\nbun add sanity-plugin-references\n```\n\n## Usage\n\n### Basic Setup\n\n```ts\nimport { defineConfig } from 'sanity'\nimport { references } from 'sanity-plugin-references'\n\nexport default defineConfig({\n  plugins: [references()],\n})\n```\n\nThis adds a **reference count badge** to all documents showing how many other documents reference them.\n\n### Adding the References Tab\n\nAdd a full References tab with search, filters, and sorting:\n\n```ts\nimport { structureTool } from 'sanity/structure'\nimport { references, referencesView } from 'sanity-plugin-references'\n\nexport default defineConfig({\n  plugins: [\n    references(),\n    structureTool({\n      defaultDocumentNode: (S) =\u003e S.document().views([\n        S.view.form(),\n        referencesView(S),\n      ]),\n    }),\n  ],\n})\n```\n\n### Options\n\n**Exclude document types** from showing the badge:\n\n```ts\nreferences({\n  exclude: ['media.tag', 'sanity.imageAsset'],\n})\n```\n\n**Customize the tab** title or icon:\n\n```ts\nreferencesView(S, { title: 'Incoming Links', icon: SomeIcon })\n```\n\n**Show tab only for specific types** by checking `schemaType` in `defaultDocumentNode`.\n\n## API\n\n### `references(config?)`\n\nMain plugin function. Adds reference badges to all documents.\n\n- `exclude?: string[]` - Document types to exclude from showing the badge\n\n### `referencesView(S, options?)`\n\nCreates a References view for Structure Builder.\n\n- `title?: string` - Tab title (default: `'References'`)\n- `icon?: ComponentType` - Tab icon (default: `LinkIcon`)\n\n### Components\n\n- **`ReferencesPane`** - Raw component for `S.view.component()` (use `referencesView()` instead)\n- **`ReferencesBadge`** - Badge component (automatically included via `references()` plugin)\n\n## License\n\n[MIT](LICENSE) © Félix Péault (Flayks)\n\n## Develop \u0026 test\n\nThis plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)\nwith default configuration for build \u0026 watch scripts.\n\nSee [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)\non how to run this plugin with hotreload in the studio.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflayks%2Fsanity-plugin-references","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflayks%2Fsanity-plugin-references","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflayks%2Fsanity-plugin-references/lists"}