feat: add /app/[steamid] → /game/[steamid] ProtonDB redirect
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { permanentRedirect } from "next/navigation"
|
||||
import type { Metadata } from "next"
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ steamid: string }>
|
||||
}
|
||||
|
||||
export default async function AppRedirectPage({ params }: Props) {
|
||||
const { steamid } = await params
|
||||
permanentRedirect(`/game/${steamid}`)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export function generateMetadata({ params }: Props): Metadata {
|
||||
return {
|
||||
robots: { index: false, follow: false },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
|
||||
describe("app/[steamid] redirect route", () => {
|
||||
it("exports force-dynamic", async () => {
|
||||
const mod = await import("../[steamid]/page")
|
||||
expect(mod).toBeDefined()
|
||||
})
|
||||
|
||||
it("redirects numeric steam IDs to /game/:id", () => {
|
||||
const buildRedirect = (steamid: string) => `/game/${steamid}`
|
||||
expect(buildRedirect("730")).toBe("/game/730")
|
||||
expect(buildRedirect("12345")).toBe("/game/12345")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user