Skip to content

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

Merged
merged 5 commits into from
Aug 18, 2025

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Aug 17, 2025

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)

@Copilot Copilot AI review requested due to automatic review settings August 17, 2025 19:32
@ovflowd ovflowd requested review from a team as code owners August 17, 2025 19:32
Copy link

vercel bot commented Aug 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Aug 18, 2025 10:43pm

Copy link
Contributor

@Copilot Copilot AI left a 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.

Copy link

codecov bot commented Aug 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.20%. Comparing base (8ab9cea) to head (254de27).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Aug 17, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Aug 17, 2025
Copy link
Contributor

github-actions bot commented Aug 17, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 95 🟢 100 🟢 100 🟢 100 🔗
/en/about 🟢 100 🟢 97 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 99 🟢 93 🟢 100 🟠 89 🔗
/en/download 🟢 95 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 100 🔗

@canerakdas
Copy link
Member

I saw a page like this in the static build output;
https://nodejs-byil8seub-openjs.vercel.app/en/blog/blog/year-2017

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]

@ovflowd
Copy link
Member Author

ovflowd commented Aug 17, 2025

I saw a page like this in the static build output;
https://nodejs-byil8seub-openjs.vercel.app/en/blog/blog/year-2017

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.

Copy link
Member

@AugustinMauroy AugustinMauroy left a 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

@ovflowd
Copy link
Member Author

ovflowd commented Aug 18, 2025

I saw a page like this in the static build output; nodejs-byil8seub-openjs.vercel.app/en/blog/blog/year-2017

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]

Hmmm weird, these pages should be working? Or at least these are the legacy categories.

@ovflowd
Copy link
Member Author

ovflowd commented Aug 18, 2025

I saw a page like this in the static build output; nodejs-byil8seub-openjs.vercel.app/en/blog/blog/year-2017

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]

OH! I see the issue /en/blog/blog/all

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Aug 18, 2025
@ovflowd
Copy link
Member Author

ovflowd commented Aug 18, 2025

@canerakdas I've fixed the issue 🫡

@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Aug 18, 2025
@ovflowd ovflowd enabled auto-merge August 18, 2025 22:43
@ovflowd ovflowd added this pull request to the merge queue Aug 18, 2025
Merged via the queue into main with commit 1335536 Aug 18, 2025
15 checks passed
@ovflowd ovflowd deleted the chore/get-rid-of-hacky-dynamic-routes branch August 18, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants