Skip to content

fix(website): generate rule docs in config hook to fix rule page 404s#557

Merged
fansenze merged 1 commit intomainfrom
fix/website-rule-nav-404-20260320
Mar 20, 2026
Merged

fix(website): generate rule docs in config hook to fix rule page 404s#557
fansenze merged 1 commit intomainfrom
fix/website-rule-nav-404-20260320

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Mar 20, 2026

Summary

All rule pages returned 404 on the deployed website while working fine locally.

Root cause: pluginRuleManifest generated rule .mdx files in the beforeBuild hook, but Rspress 2.0 discovers routes before that hook runs. Locally this was masked because generated files persisted from previous builds (gitignored but not deleted). On a fresh clone, no rule docs existed at route discovery time — confirmed by the build output showing only 7 pages in the sitemap with zero rule-specific pages.

Fix: move file generation from beforeBuild to the config hook, which executes before route discovery.

Related Links

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical navigation issue on the website where internal rule links were causing 404 errors due to incorrect routing. By adopting Rspress's client-side navigation hook, the site now handles internal links consistently with its SPA architecture, ensuring a smoother user experience and preventing broken links.

Highlights

  • Client-side Navigation: Implemented client-side navigation for internal rule links within the RuleImplementationStatus component by replacing window.location.href with Rspress's useNavigate() hook.
  • Bug Fix: Resolved 404 errors that occurred when navigating to internal rule pages, which were previously caused by full page reloads on a site configured for Single Page Application (SPA) routing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a navigation issue on the website where internal rule links were causing 404 errors. The fix involves replacing direct browser navigation (window.location.href) with client-side routing using the useNavigate hook from Rspress. This change correctly aligns the component's behavior with that of a single-page application, preventing unnecessary page reloads and resolving the 404 errors. The implementation is sound and follows standard practices for SPAs.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 20, 2026

Deploying rslint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 51ee44c
Status: ✅  Deploy successful!
Preview URL: https://89ae9dfb.rslint.pages.dev
Branch Preview URL: https://fix-website-rule-nav-404-202.rslint.pages.dev

View logs

The pluginRuleManifest wrote rule .mdx files during beforeBuild, but
Rspress 2.0 discovers routes before that hook runs. On Cloudflare Pages
(fresh clone) no generated files existed at route discovery time, causing
all rule pages to 404. Move file generation to the config hook which
executes before route discovery.
@fansenze fansenze force-pushed the fix/website-rule-nav-404-20260320 branch from 51ee44c to 6d94243 Compare March 20, 2026 09:42
@fansenze fansenze changed the title fix(website): use client-side navigation for rule links to prevent 404 fix(website): generate rule docs in config hook to fix Cloudflare 404s Mar 20, 2026
@fansenze fansenze changed the title fix(website): generate rule docs in config hook to fix Cloudflare 404s fix(website): generate rule docs in config hook to fix rule page 404s Mar 20, 2026
@fansenze fansenze enabled auto-merge (squash) March 20, 2026 09:52
@fansenze fansenze merged commit 9df7c49 into main Mar 20, 2026
16 of 17 checks passed
@fansenze fansenze deleted the fix/website-rule-nav-404-20260320 branch March 20, 2026 09:55
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.

2 participants