feat: redirect docs root by browser language - #123
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
rustfs-docs | 786dc30 | Commit Preview URL Branch Preview URL |
Aug 01 2026, 04:21 PM |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a browser-language-based entry flow for the docs root (/) so visitors land on an appropriate locale while preserving a non-JS fallback language chooser page.
Changes:
- Removes the hard-coded
/ -> /enredirect rule from generated redirect rules. - Adds a static root
public/index.html+public/language-redirect.jsto detect/snap to a locale and remember the user’s language preference. - Updates the build step to publish the new root entry page into
dist/public/index.htmland injects the redirect script into the global document head.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/language-redirects.mjs | Stops generating a forced / redirect so root can be handled by the entry page. |
| scripts/add-language-redirects.mjs | Copies the language entry index.html into the build output alongside _redirects. |
| public/language-redirect.js | Implements browser-language detection + localStorage preference + SPA navigation tracking. |
| public/index.html | Provides a root landing page that redirects by language and offers manual language links. |
| press.config.tsx | Loads the language redirect helper on all pages to persist the selected locale. |
Comment on lines
+2
to
+5
| const supportedLanguages = new Set(["en", "zh", "de", "fr", "ja"]); | ||
| const storageKey = "rustfs-docs-language"; | ||
| const getPathLanguage = () => | ||
| window.location.pathname.match(/^\/(en|zh|de|fr|ja)(?:\/|$)/)?.[1]; |
| href="/favicon-16x16.png" | ||
| /> | ||
| <link rel="manifest" href="/site.webmanifest" /> | ||
| <script src="/language-redirect.js" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: redirect docs root by browser language