Christina-Czybik

Christina Czybik

Portfolio site: Next.js (App Router), content in Sanity, hosted on Vercel.

Content (Sanity Studio at /studio)

The last two start out as the texts the site had before they were in the Studio (sanity/texts.ts), and the site shows those until they’re published.

Published changes show on the site within about a minute. Photos are served by Sanity’s image CDN, scaled to the screen they’re shown on.

Setup

Needs Node 20.6 or newer.

  1. npm install
  2. Create the Sanity project (you need to be logged in: npx sanity login):

    npx sanity init --bare --project-name "Christina Czybik" --dataset production
    

    Copy .env.example to .env.local and fill in the project ID it prints.

  3. Let the local site and Studio talk to Sanity:

    npx sanity cors add http://localhost:3000 --credentials
    
  4. npm run dev, then open http://localhost:3000 and http://localhost:3000/studio.

Importing the old site’s photos (once)

scripts/import-legacy.mjs uploads the category folders in images/ as the categories’ best-of, and the old Index’s placeholder projects (legacy/projects.js) as projects. It needs a write token:

npx sanity tokens add "Import" --role=editor

Put the token in .env.local as SANITY_API_WRITE_TOKEN, then run npm run import-legacy. It’s safe to run again: documents that already exist are left alone (npm run import-legacy -- --overwrite replaces them), and photos already in Sanity aren’t uploaded twice. Remove the token from .env.local afterwards. The site itself never needs it.

Adding the projects’ addresses (once)

Projects made before the Adresse field existed get theirs from migrations/add-project-slugs/ (each project’s name, as “Generate” makes it, and the same address the site already gives a project that has none). Deploy the site first, so the Studio online knows the field, then:

npx sanity migration run add-project-slugs            # shows what it would change
npx sanity migration run add-project-slugs --no-dry-run

It uses your Sanity login (npx sanity login), and leaves projects that already have an address alone.

Deploying on Vercel

  1. Import the repository in Vercel (framework: Next.js, no other settings).
  2. Add the environment variables NEXT_PUBLIC_SANITY_PROJECT_ID and NEXT_PUBLIC_SANITY_DATASET.
  3. Add the site’s domain(s) to Sanity’s CORS origins, so the Studio works there too: npx sanity cors add https://your-domain --credentials.

Where things are