-
-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathredirects.ts
More file actions
20 lines (16 loc) · 637 Bytes
/
redirects.ts
File metadata and controls
20 lines (16 loc) · 637 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { redirect } from '@sveltejs/kit'
/** Permanent redirects (301) */
const REDIRECTS: Record<string, string> = {
'/2025-feb': '/2025-february',
'/collages/manual_bootstrap.jpg': '/api/images/collages/manual_bootstrap.jpg',
'/selfie': '/sayno',
'/people': '/about'
}
/** Temporary redirects (302) - for time-limited campaigns, A/B tests, etc. */
const TEMPORARY_REDIRECTS: Record<string, string> = {}
export function handleRedirects(path: string) {
const permanent = REDIRECTS[path]
if (permanent) throw redirect(301, permanent)
const temporary = TEMPORARY_REDIRECTS[path]
if (temporary) throw redirect(302, temporary)
}