|
| 1 | +import type { RedirectOption } from "@docusaurus/plugin-client-redirects/lib/options"; |
| 2 | + |
| 3 | +function redirect(from: string, to: string): RedirectOption { |
| 4 | + return { from, to }; |
| 5 | +} |
| 6 | + |
| 7 | +/** |
| 8 | + * The slugs and IDs used in the Docusaurus site have evolved over time. |
| 9 | + * This file contains the redirects for the old slugs and IDs to the new ones. |
| 10 | + */ |
| 11 | +export const redirects: RedirectOption[] = [ |
| 12 | + /* -------------------------------------------------------------------------- */ |
| 13 | + /* AIRDROPS */ |
| 14 | + /* -------------------------------------------------------------------------- */ |
| 15 | + redirect("/concepts/merkle-airdrops", "/concepts/airdrops"), |
| 16 | + /* -------------------------------------------------------------------------- */ |
| 17 | + /* API */ |
| 18 | + /* -------------------------------------------------------------------------- */ |
| 19 | + redirect("/api", "/api/overview"), |
| 20 | + // TODO: change this to the new GraphQL section |
| 21 | + redirect("/api/airdrops/the-graph", "/api/overview"), |
| 22 | + redirect("/api/indexers/protocol", "/api/overview"), |
| 23 | + redirect("/api/lockup/the-graph", "/api/overview"), |
| 24 | + redirect("/api/merkle-api/intro", "/api/airdrops/merkle-api/overview"), |
| 25 | + redirect("/api/subgraphs/endpoints", "/api/lockup/indexers"), |
| 26 | + redirect("/api/subgraphs/merkle", "/api/overview"), |
| 27 | + redirect("/api/subgraphs/overview", "/api/overview"), |
| 28 | + redirect("/api/subgraphs/protocol", "/api/overview"), |
| 29 | + /* -------------------------------------------------------------------------- */ |
| 30 | + /* APPS */ |
| 31 | + /* -------------------------------------------------------------------------- */ |
| 32 | + redirect("/apps", "/apps/features/overview"), |
| 33 | + redirect("/apps/csv-support", "/apps/guides/csv-support"), |
| 34 | + redirect("/apps/features", "/apps/features/vesting"), |
| 35 | + redirect("/apps/features/airstreams", "/apps/features/airdrops"), |
| 36 | + redirect("/apps/features/general", "/apps/features/overview"), |
| 37 | + redirect("/apps/features/streams", "/apps/features/vesting"), |
| 38 | + redirect("/apps/overview", "/apps/features/overview"), |
| 39 | + redirect("/apps/support/how-to", "/support/how-to"), |
| 40 | + redirect("/apps/url-schemes", "/apps/guides/url-schemes"), |
| 41 | + /* -------------------------------------------------------------------------- */ |
| 42 | + /* INDEXERS */ |
| 43 | + /* -------------------------------------------------------------------------- */ |
| 44 | + redirect("/api/airdrops/endpoints", "/api/airdrops/indexers"), |
| 45 | + redirect("/api/flow/endpoints", "/api/flow/indexers"), |
| 46 | + redirect("/api/lockup/endpoints", "/api/lockup/indexers"), |
| 47 | + /* -------------------------------------------------------------------------- */ |
| 48 | + /* LEGACY: 2019-2021 */ |
| 49 | + /* -------------------------------------------------------------------------- */ |
| 50 | + redirect("/protocol/faq/basics", "/concepts/what-is-sablier"), |
| 51 | + redirect("/protocol/guides/chains", "/guides/legacy/overview"), |
| 52 | + redirect("/protocol/guides/getting-started", "/guides/legacy/overview"), |
| 53 | + redirect("/protocol/introduction", "/concepts/what-is-sablier"), |
| 54 | + redirect("/protocol/subgraphs/endpoints", "/api/overview"), |
| 55 | + redirect("/contracts/v1/deployments", "/guides/legacy/deployments"), |
| 56 | + redirect("/contracts/v1/guides/getting-started", "/guides/legacy/overview"), |
| 57 | + redirect("/contracts/v1/overview", "/guides/legacy/overview"), |
| 58 | + /* -------------------------------------------------------------------------- */ |
| 59 | + /* LOCKUP: 2024 and Earlier */ |
| 60 | + /* -------------------------------------------------------------------------- */ |
| 61 | + redirect("/concepts/protocol/fees", "/concepts/fees"), |
| 62 | + redirect("/concepts/protocol/nft", "/concepts/nft"), |
| 63 | + redirect("/concepts/protocol/stream-types", "/concepts/lockup/stream-shapes"), |
| 64 | + redirect("/concepts/protocol/streaming", "/concepts/streaming"), |
| 65 | + redirect("/concepts/protocol/transferability", "/concepts/transferability"), |
| 66 | + redirect("/concepts/sablier-protocol", "/concepts/what-is-sablier"), |
| 67 | + redirect("/contracts/v2/deployments/v2.0", "/guides/lockup/previous-deployments/v1.0"), |
| 68 | + redirect("/contracts/v2/deployments/v2.1", "/guides/lockup/previous-deployments/v1.1"), |
| 69 | + redirect("/contracts/v2/guides", "/guides/lockup/overview"), |
| 70 | + redirect("/contracts/v2/reference/overview", "/reference/overview"), |
| 71 | + redirect("/contracts/v2/security", "/concepts/security"), |
| 72 | + redirect("/csv", "/apps/guides/csv-support"), |
| 73 | +]; |
| 74 | + |
| 75 | +export function createRedirects(existingPath: string) { |
| 76 | + const redirects = []; |
| 77 | + // Redirect /concepts/protocol/** to /concepts/lockup/** |
| 78 | + if (existingPath.startsWith("/concepts/lockup/")) { |
| 79 | + redirects.push(existingPath.replace("/concepts/lockup/", "/concepts/protocol/")); |
| 80 | + } |
| 81 | + // Redirect /contracts/v1/guides/** to /guides/legacy/** |
| 82 | + else if (existingPath.startsWith("/guides/legacy/")) { |
| 83 | + redirects.push(existingPath.replace("/guides/legacy/", "/contracts/v1/guides/")); |
| 84 | + } |
| 85 | + // Redirect /contracts/v2/reference/** to /reference/lockup/** |
| 86 | + else if (existingPath.startsWith("/reference/lockup/")) { |
| 87 | + redirects.push(existingPath.replace("/reference/lockup/", "/contracts/v2/reference/")); |
| 88 | + } |
| 89 | + // Redirect /contracts/v1/** to /reference/legacy/** |
| 90 | + else if (existingPath.startsWith("/reference/legacy/")) { |
| 91 | + redirects.push(existingPath.replace("/reference/legacy/", "/contracts/v1/")); |
| 92 | + } |
| 93 | + // Redirect /contracts/v2/guides/** to /guides/lockup/examples/** |
| 94 | + else if (existingPath.startsWith("/guides/lockup/examples/")) { |
| 95 | + redirects.push(existingPath.replace("/guides/lockup/examples/", "/contracts/v2/guides/")); |
| 96 | + } |
| 97 | + |
| 98 | + return redirects; |
| 99 | +} |
0 commit comments