refactor(gatsby-node): simplify page creation logic and remove redundant redirects
Fix: #7606
The problem was in gatsby-node.js where the code was creating redirects from paths with trailing slashes to paths without trailing slashes when running in CI mode. This conflicted with the trailingSlash: "never" configuration in gatsby-config.js
What I Changed
I removed the redirect creation logic in the envCreatePage function (lines 56-72) that was causing the conflicts. The code was attempting to create redirects like:
- From:
/learn/learning-paths/mastering-kubernetes-for-engineers/ - To:
/learn/learning-paths/mastering-kubernetes-for-engineers
Since your Gatsby configuration already specifies trailingSlash: "never", these redirects were redundant and caused warnings because Gatsby was creating both the pages and the redirects for the same paths.
Result
The build should now be clean without the warnings about routes matching both page and redirect. The pages will continue to work correctly without trailing slashes as configured in your gatsby-config.js.
The fix has been applied successfully. The build warnings about conflicting page and redirect routes should now be resolved. The change removes the redundant redirect creation that was conflicting with your trailingSlash: "never" configuration.
Preview deployment for PR #7634 removed.
This PR preview was automatically pruned because we keep only the 6 most recently updated previews on GitHub Pages to stay within deployment size limits.
If needed, push a new commit to this PR to generate a fresh preview.