Skip to content

Commit 83eb100

Browse files
committed
add some product redirects
1 parent 1dc55ed commit 83eb100

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
export const productRedirects: {[k: string]: string} = {
3+
"blank-t-shirt": "blank-t-shirt-short-sleeve",
4+
"2023-sticker-pack-1": "sticker-pack-set-2",
5+
"2023-sticker-pack": "sticker-pack-set-2",
6+
"2022-sticker-pack": "2022-sticker-pack-1",
7+
"tall-blank-shirt": "blank-t-shirt-short-sleeve"
8+
}

src/routes/(info)/lttstore/products/[handle]/+page.server.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010

1111
import { createTables } from "../../createTables.ts";
1212
import { retryD1 } from "$lib/utils.ts";
13+
import { productRedirects } from "$lib/lttstore/product_redirects.ts";
1314

1415
const DAY = 24 * 60 * 60e3;
1516

@@ -41,7 +42,14 @@ export const load = (async ({platform, params, url}) => {
4142
.first<ProductsTableRow>()
4243
);
4344

44-
if(product == null) throw error(404, "Product not found!");
45+
if(product == null) {
46+
const to = productRedirects[handle];
47+
if(to) {
48+
throw redirect(301, to);
49+
} else {
50+
throw error(404, "Product not found!");
51+
}
52+
}
4553

4654

4755
const stockCheckDistance = Date.now() - product.stockChecked;

0 commit comments

Comments
 (0)