Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Add the Introducing PolicyBench research post
- Add UK Universal Credit rebalancing analysis dashboard at /uk/uc-rebalancing
- Add UK fuel duty rise cancellation analysis dashboard at /uk/cancelling-fuel-duty-rise
- Redirect the /policybench and /:countryId/policybench vanity paths to policybench.org
changed:
- Proxy UK Python package docs at /uk/python and UK API docs at /uk/api so the country-parameterized "Python" and "API" nav links work on UK pages
- Align the calculator app header (e.g. /us/reports) with the main website header — hover-open dropdowns, per-item underline, Model dropdown with sub-items, Python link, and Events under About
10 changes: 10 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
"source": "/pe84",
"destination": "/us/pe84",
"permanent": false
},
{
"source": "/policybench",
"destination": "https://policybench.org",
"permanent": false
},
{
"source": "/:countryId/policybench",
"destination": "https://policybench.org",
"permanent": false
}
],
"rewrites": [
Expand Down
13 changes: 13 additions & 0 deletions website/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ const nextConfig: NextConfig = {
destination: "/us/pe84",
permanent: true,
},
// Vanity redirects to the standalone PolicyBench site (external).
// policybench.org is country-agnostic, so both the bare and
// country-prefixed paths land on its root.
{
source: "/policybench",
destination: "https://policybench.org",
permanent: false,
},
{
source: "/:countryId/policybench",
destination: "https://policybench.org",
permanent: false,
},
{
source: "/uk/ads-dashboard",
destination: "/us/ads-dashboard",
Expand Down
30 changes: 30 additions & 0 deletions website/src/__tests__/config/next-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ async function getBeforeFileRewrites() {
return rewrites.beforeFiles ?? [];
}

async function getRedirects() {
if (!nextConfig.redirects) {
throw new Error("Expected Next config to define redirects.");
}

return nextConfig.redirects();
}

describe("nextConfig rewrites", () => {
test("serves PolicyEngine icon fallbacks before app-zone proxies", async () => {
const beforeFiles = await getBeforeFileRewrites();
Expand All @@ -68,3 +76,25 @@ describe("nextConfig rewrites", () => {
).toBeGreaterThan(expectedPolicyEngineIconRewrites.length - 1);
});
});

describe("nextConfig redirects", () => {
test("redirects the bare /policybench vanity path to policybench.org", async () => {
const redirects = await getRedirects();

expect(redirects).toContainEqual({
source: "/policybench",
destination: "https://policybench.org",
permanent: false,
});
});

test("redirects the country-prefixed /policybench vanity path to policybench.org", async () => {
const redirects = await getRedirects();

expect(redirects).toContainEqual({
source: "/:countryId/policybench",
destination: "https://policybench.org",
permanent: false,
});
});
});
Loading