Tina blog setup

Markdown posts live in content/post/. Subfolders appear as sections on /posts. The visual editor is at /admin after a production build, or while running dev with Tina.


Websites

WhatURL
Tina Cloud (project, Client ID, API tokens)https://app.tina.io
Tina documentationhttps://tina.io/docs

Steps

  1. Sign in at app.tina.io and create a project.
  2. Connect the same GitHub repository you deploy from (Tina indexes Markdown on your branch).
  3. Copy the Client ID from the project dashboard.
  4. Open Tokens and create a token for CLI / CI (used by tinacms build and npm run build).

Local environment

Create .env.local at the repo root (never commit):

NEXT_PUBLIC_TINA_CLIENT_ID=your-client-id-uuid
TINA_TOKEN=your_tina_token
# Optional default branch:
# NEXT_PUBLIC_TINA_BRANCH=main
VariableExposed to browser?Role
NEXT_PUBLIC_TINA_CLIENT_IDYesBinds Admin and builds to your Cloud project
TINA_TOKENNoRequired for tinacms build / production builds
NEXT_PUBLIC_TINA_BRANCHYesOptional; defaults to git / Vercel branch if unset

Alternative (client id only): copy tina/tina.local.example.json to tina/tina.local.json with { "clientId": "your-uuid" }. The script scripts/load-tina-env.cjs merges .env, .env.local, and that file. Keep TINA_TOKEN in .env.local or CI secrets only.


Commands

  • npm run dev: Tina GraphQL (default port 4001) and Next.js; removes stale public/admin so Admin matches the local schema.
  • npm run build: runs tinacms build then next build. Requires NEXT_PUBLIC_TINA_CLIENT_ID and TINA_TOKEN.

Deploy and CI

PlatformWhere to add variables
VercelProject Settings > Environment Variables (step-by-step: Vercel environment variables)
GitHub ActionsRepo Settings > Secrets and variables > Actions

Use the same names as in .env.local. Optional: repository variable NEXT_PUBLIC_TINA_BRANCH.


Repo files to know

  • tina/tina-lock.json: commit after schema changes.
  • tina/__generated__/: regenerated by builds; local dev targets http://localhost:4001/graphql.
  • Unicode paths (e.g. non-ASCII folder names) are supported; see src/lib/blog-path.js.

Troubleshooting

IssueWhat to do
Datalayer server is busy on port 9000Stop other tinacms dev processes, or set TINA_DATALAYER_PORT (e.g. 9001) in .env.local if your workflow supports it.
Admin / client undefinedSet NEXT_PUBLIC_TINA_CLIENT_ID, restart dev.
Build fails: missing tokenAdd TINA_TOKEN everywhere you run npm run build.

Back to setup hub

Discussion

Likes and comments on this post.

Like

One like per visitor (by IP). Tap again to remove your like.

Comments

  • Loading comments…
Loading your playlist...