This is a Next.js project bootstrapped with create-next-app
.
-
Run
npm i
-
Add .env.local file with variable STORYBLOK_PREVIEW_ACCESS_TOKEN.
-
Run the development server:
npm run dev
-
You should now be able to access http://localhost:3000/home in your browser.
-
If you also want to preview your local environment in the Storyblok Visual Editor, you need to configure localhost to use https.
- Install the proxy:
sudo npm install -g local-ssl-proxy
- Run the proxy:
npm run https
- Test the proxy by browsing to https://localhost:3001/home
- Install the proxy:
This repository assumes a Storyblok space with the following settings and content:
- Visual Editor location: https://localhost:3001/api/draft?slug=
- Blocks: Page and Feature (other blocks are not implemented)
- Content: a Home page (slug=home) of content type 'Page', with a 'Feature' block.
In order to run the production build locally, execute the following commands:
npm run build
npm start
This will create a production build, including optimizations. The [[...slug]] route will be static. Only the first request will render the page (with SSR). Subsequent requests will use the cached static file.