Pajamas is a JAMStack Starter template built with Next.js, Tailwind CSS & Sanity CMS.
First Install next-sanity
plugin:
yarn add next-sanity
Open .env.local
and add the sanity project id. If you want to set different dataset than production, you can add that as well (optional)
Heads up! Make sure you copy those .env
variables to Vercel when you publish the project.
Every site has some global settings, We can manage them through Sanity. But as of now (May 2022) Sanity does not directly support singleton documents. So we do it using a simple hack. To do that, first we need to create a new site Settings Page in Sanity and then disable the create
and delete
__experimental_actions in /schemas/siteConfig.js
so only one site-settings is created. (instead of an array)