examples/cms-prismic/README.md
This example showcases Next.js's Static Generation feature using Prismic as the data source.
Once you have access to the environment variables you'll need, deploy the example using Vercel.
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example cms-prismic cms-prismic-app
yarn create next-app --example cms-prismic cms-prismic-app
pnpm create next-app --example cms-prismic cms-prismic-app
First, create a Prismic account and repository with the following command:
npx @slicemachine/init
This command will:
Optional: To see the premade content models, start the Slice Machine app.
npm run slicemachine
Slice Machine should be available on http://localhost:9999 once started.
Go to the Prismic dashboard and select your Prismic repository.
Once in, click on Create new and select the Author type:
Save and publish the document.
Next, go back to the documents list, click on Create new and select the Post type:
Important: For each document, you need to click Publish after saving. If not, the document will be in the draft state.
npm run dev
# or
yarn dev
Your blog should be up and running on http://localhost:3000! If it doesn't work, post on GitHub discussions.
On your repository page, go to Settings, click on Previews, and then Create a New Preview. Fill the form like so for development previews:
http://localhost:3000/api/previewOnce saved, go to one of the posts you created and:
[Draft] in front of the title.You should now be able to see the updated title. To exit preview mode, click on the "x" icon in the purple Prismic toolbar in the bottom left corner of the page.
You can deploy this app to the cloud with Vercel (Documentation).
To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and import to Vercel.
Alternatively, you can deploy using our template by clicking on the Deploy button below.