A website for an amateur theater in Brno built using SvelteKit with content pulled from Kontent.ai.
To run the site in development, follow these steps:
-
Install dependencies by running
npm install
. -
Add your Kontent.ai environment ID in a
.env
file:PUBLIC_KONTENT_ENVIRONMENT_ID=abc123
-
Start a development server:
npm run dev # or start the server and open the app in a new browser tab npm run dev:open
To create a production version of your app, follow these steps:
-
Add your Kontent.ai environment ID to the environment:
export PUBLIC_KONTENT_ENVIRONMENT_ID=abc123
-
Build the site:
npm run build
You can preview the production build by running npm run preview
.
You can find the model for the content types in Kontent.ai in the src/kontent-types directory.
They were generated using the Kontent.ai Model Generator.
If the content model changes, you can generate new types. You need a Management API key. Then run this command:
npx kontent-generate --exportRoles=false --exportWebhooks=false --outputDir=./src/kontent-types --environmentId=<ENVIRONMENT_ID> --apiKey=<API_KEY>
You can run the site locally with draft content to preview how it looks. Only run it locally unless you don't worry about draft content becoming public.
To do so, follow these steps:
- Create a Kontent Delivery API key with content preview permissions.
- Save the API key and preview as true in your
.env
file:PUBLIC_KONTENT_PREVIEW_API_KEY=abc123 PUBLIC_KONTENT_PREVIEW=true