An opinionated and minimally styled starter template with Tailwind CSS and pre-built schema for rapid website development.
🖋️ Published on Sanity.io
🚀 Checkout the demo site.
⏱️ For the latest updates, view the changelog.
- Modern Frontend Development with Next.js (App Router, RSC, Typescript) and Tailwind CSS.
- Pre-configured Sanity schema for rapid webpage and blog development.
- Pre-built common website components (next/src/ui).
- Auto-generated sitemap.xml and blog rss.xml.
- Live previews when set up with a git branch.
👉 Check out on GitHub nuotsu/next-sanity-template
npm -y create sanity@latestNote
The CLI will ask to create new directory with the Sanity files, but you can remove once the project ID is retrieved.
- sanity/sanity.cli.ts
- sanity/sanity.config.ts
- next/.env.local (duplicate .env.example)
- retrieve a token from Sanity to allow for live previews
- Site settings (sanity/schemas/documents/site.ts)
- Pages (sanity/schemas/documents/page.ts)
Important
Required: Add a page with the slug index for the Homepage
Optional: Add a page with the slug 404 for the 404 page
- Blog posts (sanity/schemas/documents/blog.post.ts)
For Vercel:
npm i sanity-plugin-dashboard-widget-vercelFor Netlify:
npm i sanity-plugin-dashboard-widget-netlify- Create a new git branch (call it anything—e.g.
stagingorpreview) and set an environment variable specific to that branch in your deployment service (Vercel or Netlify):
git checkout -b stagingENABLE_PREVIEW = true
# also set in next/src/lib/env.ts- In sanity/src/defaultDocumentNode.ts, set
previewUrlto your branch deployment URL
// e.g. Vercel
const previewUrl = "https://your-site-git-staging.vercel.app";
// e.g. Netlify
const previewUrl = "https://staging--your-site.netlify.app";- Global Types in Next.js
<Img>component for Sanity CDN images