Skip to content

feat: add opt-in Sanity CMS integration with @sanity/client v7.x#14

Draft
Axel-Moreau with Copilot wants to merge 2 commits into
mainfrom
copilot/update-sanity-to-version-5-1
Draft

feat: add opt-in Sanity CMS integration with @sanity/client v7.x#14
Axel-Moreau with Copilot wants to merge 2 commits into
mainfrom
copilot/update-sanity-to-version-5-1

Conversation

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

No CMS was wired up — all content lived as hardcoded TypeScript files in src/content/. This adds a fully opt-in Sanity integration: when SANITY_PROJECT_ID is set, content is fetched from Sanity at build time; otherwise the static files are used unchanged.

How it works

  • scripts/fetch-content.ts — pre-build script that runs GROQ queries against Sanity and writes TypeScript files to src/content/_generated/, mirroring the exact export signatures of the static files
  • vite.config.ts — adds a conditional alias: @/content/* → src/content/_generated/* when SANITY_PROJECT_ID is set; zero component code changes needed
  • .github/workflows/deploy.yml — adds a conditional "Fetch content from Sanity" step (skipped when the secret is absent)
  • sanity/schemas.ts — complete Sanity Studio schema definitions for all content types (siteSettings, pageContent, agendaTrack, resource, sponsorshipConfig, sponsor) ready to drop into a Studio project

Activation

Add three repository secrets and push:

Secret Value
SANITY_PROJECT_ID From sanity.io/manage
SANITY_DATASET production
SANITY_TOKEN Read-only API token

Content type mapping

Sanity document Generates
siteSettings (singleton) site.ts + agendaIntro field
pageContent (singleton) sections.ts
agendaTrack (one per tab) agenda.ts
resource (one per item) resources.ts
sponsorshipConfig + sponsor sponsors.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants