This is Starter kit with a Next.js app enabled with Uniform Context and Contenful. This starter requires the Uniform Context app to be installed in your Contentful space..
First, you must provide API keys to connect with empty Uniform App project and empty space in Contentful:
-
Copy
.env.exampleinto.envand fill all the keys -
Enable SSR or SSG depending on NEXT_USE_SSR env variable, it is set to the SSG mode out of the box. See
.env.example:NEXT_USE_SSR=0 -
Run the following script to generate the slug page file:
npm run generate:slug-page
-
Import the Uniform Context definitions into your Uniform project (make sure your Uniform API key has permissions to write to Uniform Context):
npm run push:context -
Generate the Uniform Context manifest file locally by running this script:
npm run generate:manifest
-
Install the latest Contentful CLI:
npm install contentful-cli -gmore details here. -
Make sure you logged into Contentful CLI with
contentful loginand have access to the space you are about to import the content to. -
Import content model and content entries with assets:
contentful space import --content-file ./scripts/export.json --space-id <YOUR_CONTENTFUL_SPACE_ID> -
Install the Uniform app from marketplace
All configured fields for Context App should be automatically configured in App installation page
-
Make sure you apply the Uniform app to each field where Uniform is expected to be used:
- Open field settings
- Open the Appearance tab
- Select the Uniform app
- Confirm & Save the field changes.
Repeat the following steps below for each of the models and field combination:
- Page -> Enrichment Tags - Hero -> Personalization Criteria - Talk -> Personalization Criteria - Talk List -> Personalization Criteria
For the security reason all automatically created fields in Content Types needs to manually configured to use Uniform Context in the Appearance section for each field.
-
Optional: pull latest Typescript types for content types:
npm run generate:types
-
Run dev server:
npm run dev -
Run the production build:
npm run build npm run start -
Open http://localhost:3000 with your browser to see the result.
-
Export latest Contentful content model and content (you may need to login into Contentful CLI first):
contentful space export --config .\scripts\export-config.json --space-id <YOUR_CONTENTFUL_SPACE_ID> -
Export the Uniform Context entities from your project:
npm run pull:context
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!