Skip to content

refactor(gatsby-node): simplify page creation logic and remove redundant redirects#7634

Open
Abmarne wants to merge 1 commit intolayer5io:masterfrom
Abmarne:master
Open

refactor(gatsby-node): simplify page creation logic and remove redundant redirects#7634
Abmarne wants to merge 1 commit intolayer5io:masterfrom
Abmarne:master

Conversation

@Abmarne
Copy link
Copy Markdown
Contributor

@Abmarne Abmarne commented Apr 15, 2026

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.

…ant redirects

- Removed creation of redundant redirects for page paths during CI builds
ref-actor Simplified(gatsby-node): simplify page creation and remove lite mode redirects env

CreatePage wrapper to directly call createPage
- Removed legacy lite mode redirects and related placeholder pages
- Simplified env- Retained all page templates andCreate GraphQL queries without modification
-Page function to directly call createPage without redirects
 Kept collection filtering and pagination- Removed redundant slug slash redirects in CI environment
 logic intact
- Kept existing GraphQL queries and page creation- No logic intact
- Maintained excluded collections handling and functional changes to node field creation or schema customization full site build flag
- Ensured dev
- Improved code clarity 404 page caching and webpack config remain unchanged by removing unnecessary redirect side effects

Signed-off-by: Abmarne <abhirajmarne11@gmail.com>
@github-actions
Copy link
Copy Markdown

🚀 Preview for PR #7634

🌐 https://layer5io.github.io/layer5/pr-preview/pr-7634/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warnings when running npm run build

1 participant