Skip to content

Commit

Permalink
feat(redirects): don't bake grapher redirects to _redirects file
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Oct 23, 2023
1 parent f3add8f commit d31607b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion baker/SiteBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export class SiteBaker {
const grapherRedirects = await getGrapherRedirectsMap("")
await this.stageWrite(
path.join(this.bakedSiteDir, `grapher/_grapherRedirects.json`),
JSON.stringify(Object.fromEntries(grapherRedirects))
JSON.stringify(Object.fromEntries(grapherRedirects), null, 2)
)

this.progressBar.tick({ name: "✅ baked redirects" })
Expand Down
8 changes: 0 additions & 8 deletions baker/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,12 @@ export const getRedirects = async () => {
}`
)

// Redirect old slugs to new slugs
const grapherRedirectsMap = await getGrapherRedirectsMap()
const grapherRedirects = Array.from(grapherRedirectsMap).map(
([oldSlug, newSlug]) => `${oldSlug} ${newSlug} 302`
)

// Add newlines in between so we get some more overview
return [
...staticRedirects,
"",
...wpRedirects,
"",
...grapherRedirects,
"",
...dynamicRedirects, // Cloudflare requires all dynamic redirects to be at the very end of the _redirects file
]
}
Expand Down

0 comments on commit d31607b

Please sign in to comment.