In this guide, we’ll walk through creating a brand new P1 site on Pantheon. Follow this guide in order:
Sign up for a P1 account at https://content.pantheon.io. (Get in touch with us; at this time, it is a private release, and we will need to manually provision access for you).
Before you start, you need:
On your local environment, initialize a site using our SDK starter:
$pnpm create @pantheon-systems/p1-starter-kit
Answer the option questions from the CLI. For these instructions, choose pnpm if you have it installed.
Ensure pnpm install (or npm install) executes locally
Commit and push to your GitHub repository
Create your site in P1 dashboard (https://content.pantheon.io)
Once the P1 content site is created, generate a token and get your ID
The token will only be shown once; save it to personal secrets or in a secure temporary place, or keep the modal open
Set these secrets on your Pantheon Next.js site. Your localhost .env can omit the “P1_SITE_URL” (which serves as a redirect location after authentication)
NEXT_PUBLIC_CSS_SITE_ID=your-site-id-from-popup-aboveCSS_API_KEY=your-token-from-popup-aboveP1_SITE_URL=your-site-url-once-you-have-it-you-can-start-without-for-local-development
Check that the site is executing well on localhost by running pnpm run dev
In particular, test connectivity with the P1 back end by visiting the editor page, appending /p1 to your site URL
Push the codebase of your site created above to a GitHub repository
Go to Pantheon.io dashboard to create your hosted Next.js site
Create a Next.js site
When creating that site, choose “from an existing repository” and pick the repository created above
When asked for secrets, paste the secrets above. For P1_SITE_URL, the url should be https://dev-yoursitename.pantheonsite.io
Deploy
At this stage, you should be able to test end-to-end P1 with a hosted site on Pantheon.
From there, you can deploy to a test or live environment if you wish, following our Next.js documentation. A live environment is required for any production use, especially to set your own domain name.
In this guide, we’ll walk through creating a brand new P1 site on Pantheon. Follow this guide in order: