Official website for the Bergen Triathlon.
Frontend is written in Svelte with content being served from a ContentFul backend, currently at https://app.contentful.com/spaces/{space-id}
The content is being fetched using the Contentful GraphQL Content API
- Add a file with name
.env
to add contentful tokens. Find the access token underSettings
->API Keys
in contentful dashboard.
VITE_CONTENTFUL_DELIVERY_API_ACCESS_TOKEN=Fetch-Token-From-Contentful-backend
VITE_CONTENTFUL_SPACE_ID={space-id}
- Add secrets for accessing Vimeo API
VITE_VIMEO_ACCESS_TOKEN={access token}
- Run
npm install
- Run
npm run dev
to run the development server
Visit https://graphql.contentful.com/content/v1/spaces/{SPACE}/explore?access_token={CDA_TOKEN} to test queries agains Contentful graph api.
Before creating a production version of your app, install an adapter for your target environment. Then:
npm run build
You can preview the built app with
npm run preview
, regardless of whether you installed an adapter. This should not be used to serve your app in production.
Contentful can serve two kinds of content:
- published
- draft
Both published and draft content is returned from the Contentful Graph API, but to retrieve draft content a different API key is required.
Env variables required to build application with Contentful draft content:
VITE_CONTENTFUL_DELIVERY_API_ACCESS_TOKEN={contentful_preview_token}
VITE_CONTENTFUL_PREVIEW=enabled
For pull requests, Netlify will create a preview-deploy
. These deployments
are configured with these environment variables to allow pull requests to demo
new functionality on unpublished CMS content.