-
Notifications
You must be signed in to change notification settings - Fork 3
Generate static params #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds static site generation (SSG) support to the Next.js template by implementing the generateStaticParams function. This function queries all pages from Optimizely CMS at build time and generates static routes for them, improving performance by pre-rendering pages. The implementation includes adding a new APPLICATION_HOST environment variable to filter pages belonging to the current application.
Key Changes
- Implements
generateStaticParamsto fetch and generate static routes for up to 100 pages from Optimizely CMS - Adds
dynamicParams = trueconfiguration to allow non-pre-rendered routes to be handled at runtime - Introduces
APPLICATION_HOSTenvironment variable for filtering pages by host
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| samples/nextjs-template/src/app/[...slug]/page.tsx | Adds generateStaticParams function with GraphQL query to fetch all pages, transform their paths, and return properly formatted route parameters for Next.js static generation |
| samples/nextjs-template/.env.in | Adds APPLICATION_HOST environment variable configuration entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TRomesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR implements
generateStaticParamsfor thenextjs-template