-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore: get rid of hacky dynamic pages, use proper app router #8086
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 removes the hacky IGNORE_ROUTES
and DYNAMIC_ROUTES
system in favor of proper Next.js App Router patterns. The refactoring breaks down page generation logic into reusable components and introduces dedicated route handlers for different content types.
- Eliminates hardcoded dynamic route mappings and ignored routes logic
- Refactors page rendering into composable functions (
getLocaleAndPath
,getMarkdownContext
,renderPage
) - Creates dedicated blog route handler using proper Next.js file-based routing
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
apps/site/next.dynamic.mjs |
Simplifies route filtering by removing dynamic route constants and ignored route logic |
apps/site/next.dynamic.constants.mjs |
Removes all dynamic route and ignored route definitions, keeping only base metadata |
apps/site/app/[locale]/page.tsx |
Refactors monolithic page component into reusable functions for locale/path resolution, markdown processing, and rendering |
apps/site/app/[locale]/blog/[...path]/page.tsx |
New dedicated blog route handler with proper static param generation for blog categories and pagination |
apps/site/app/[locale]/[...path]/page.tsx |
Updates catch-all route to use refactored page functions and adds proper page component implementation |
Comments suppressed due to low confidence (1)
apps/site/app/[locale]/page.tsx:109
- The condition
if (source.length && filename.length)
was removed but the code inside still executes. This means the function will attempt to parse markdown content even when source or filename are empty, which could cause errors.
// This parses the source Markdown content and returns a React Component and
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8086 +/- ##
=======================================
Coverage 73.20% 73.20%
=======================================
Files 97 97
Lines 8448 8448
Branches 227 227
=======================================
Hits 6184 6184
Misses 2263 2263
Partials 1 1 ☔ View full report in Codecov by Sentry. |
Lighthouse Results
|
I saw a page like this in the static build output; It might be good to check the others as well 🤔 ├ ● /[locale]/blog/[...path]
├ ├ /en/blog/blog/all
├ ├ /en/blog/blog/wg
├ ├ /en/blog/blog/year-2017
├ └ [+525 more paths] |
Yeah, blog posts are expected on the static output. Since our static builds are fast I've also included the localized blog pages there. |
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.
LGMT ! that's cool
Hmmm weird, these pages should be working? Or at least these are the legacy categories. |
OH! I see the issue |
@canerakdas I've fixed the issue 🫡 |
This PR removes the hacky IGNORE_ROUTES and DYNAMIC_ROUTES by breaking down pieces of what allows us to generate pages and reusing them accordingly.
This allows for us to actually use the path-based Router from Next.js, for our "dynamic routes" such as blog categories / blog category pagination. And future pieces such as the download archive which could also use a
/[locale]/download/archive/[version]/page.tsx
file. (cc @canerakdas)