Skip to content

Commit b4a7778

Browse files
authored
feat: remove table beta and add removed version redirects (#1133)
1 parent 19b0f00 commit b4a7778

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/libraries/libraries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export const table: LibrarySlim = {
312312
],
313313
latestVersion: 'v9',
314314
latestBranch: 'main',
315-
availableVersions: ['v9', 'v8', 'beta'],
315+
availableVersions: ['v9', 'v8'],
316316
scarfId: 'dc8b39e1-3fe9-4f3a-8e56-d4e2cf420a9e',
317317
defaultDocs: 'overview',
318318
sitemap: {

src/routes/-library-landing-route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function beforeLoadLibraryLanding(
2828
href: string,
2929
) {
3030
const library = validateLibraryVersion(libraryId, version, () => {
31-
throw redirect({ href: `/${libraryId}/latest` })
31+
throw redirect({ href: `/${libraryId}/latest`, statusCode: 308 })
3232
})
3333

3434
library.handleRedirects?.(href)

src/routes/_library/$libraryId/$version.index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const Route = createFileRoute('/_library/$libraryId/$version/')({
1313
library.handleRedirects?.(location.href)
1414

1515
validateLibraryVersion(library.id, params.version, () => {
16-
throw redirect({ href: `/${library.id}/latest` })
16+
throw redirect({ href: `/${library.id}/latest`, statusCode: 308 })
1717
})
1818

1919
redirectToStaticLanding(library.id, params.version)

src/routes/_library/$libraryId/$version.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ export const Route = createFileRoute('/_library/$libraryId/$version')({
1414
beforeLoad: async (ctx) => {
1515
const { libraryId, version } = ctx.params
1616
const library = validateLibraryVersion(libraryId, version, () => {
17+
// Permanent redirect so retired versions (e.g. /table/beta/...) keep SEO
18+
// equity when rewritten to /latest with the rest of the path intact.
1719
throw redirect({
18-
params: { libraryId, version: 'latest' } as never,
20+
href: ctx.location.href.replace(
21+
`/${libraryId}/${version}`,
22+
`/${libraryId}/latest`,
23+
),
24+
statusCode: 308,
1925
})
2026
})
2127

0 commit comments

Comments
 (0)