Add /policybench vanity redirect to policybench.org#2842
Merged
Conversation
Add an ExternalRedirect component (react-router's Navigate can't target another domain) and route /policybench and /[countryId]/policybench to https://policybench.org, so the short paths land on the standalone benchmark site. Covered by a unit test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a small routing utility to support “vanity” paths under policyengine.org that redirect users to the standalone PolicyBench domain (policybench.org), covering both country-scoped and top-level paths.
Changes:
- Introduces an
ExternalRedirectReact component that performs awindow.location.replace(to)and renders a fallback link. - Adds two new routes in
PolicyEngine.jsxfor/policybenchand/:countryId/policybenchthat useExternalRedirect. - Adds unit tests for
ExternalRedirect.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/routing/ExternalRedirect.jsx | New component to perform external-domain redirects with a simple fallback UI. |
| src/PolicyEngine.jsx | Adds vanity routes for /policybench and /:countryId/policybench using ExternalRedirect. |
| src/tests/routing/externalRedirect.test.js | Adds unit coverage for redirect invocation and fallback link rendering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Routes the short vanity paths to the standalone PolicyBench site:
policyengine.org/policybench→https://policybench.orgpolicyengine.org/us/policybench(and any/[countryId]/policybench) →https://policybench.orgWhy
PolicyBench lives at its own domain (policybench.org). These memorable short paths under policyengine.org give a clean entry point to share verbally or in print for the launch.
How
react-router's
<Navigate>only resolves in-app paths, so a smallExternalRedirectcomponent doeswindow.location.replace(to)and renders a fallback link. Two routes are added inPolicyEngine.jsx: a country-scopedpolicybench(ranked above the:appNamecatch-all) and a top-level/policybench. Unit-tested insrc/__tests__/routing/externalRedirect.test.js.Independent of the launch blog PR (#2841); can merge on its own.
🤖 Generated with Claude Code