From 75571bbfe0eeb173909491025a3dc915e1777dbe Mon Sep 17 00:00:00 2001 From: Stan Runge Date: Mon, 26 Oct 2026 00:24:27 +0000 Subject: [PATCH] lists: retire scientific-papers (items live in /trackers/books?kind=papers) and cars-trains-planes-to-spot (-> /trackers/spotting); archived list URLs 301, books-to-read too --- src/routes/lists/[slug]/+page.server.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/routes/lists/[slug]/+page.server.ts b/src/routes/lists/[slug]/+page.server.ts index ccbe012..8f025af 100644 --- a/src/routes/lists/[slug]/+page.server.ts +++ b/src/routes/lists/[slug]/+page.server.ts @@ -21,6 +21,13 @@ import { and, eq, ne } from 'drizzle-orm'; import { error, fail, redirect } from '@sveltejs/kit'; import type { Actions, PageServerLoad } from './$types'; +/** Archived lists and where their old URL now points. Only used once the list is gone. */ +const RETIRED_LISTS: Record = { + 'books-to-read': '/trackers/books', + 'scientific-papers': '/trackers/books?kind=papers', + 'cars-trains-planes-to-spot': '/trackers/spotting' +}; + async function currentList(slug: string) { const list = await findList(slug); if (!list) error(404, 'List not found'); @@ -79,7 +86,12 @@ export const load: PageServerLoad = async ({ params }) => { } } const list = await getList(params.slug); - if (!list) error(404, 'List not found'); + if (!list) { + // Retired lists whose items moved into a tracker (or that were dropped) keep their URL. + const moved = RETIRED_LISTS[params.slug]; + if (moved) redirect(301, moved); + error(404, 'List not found'); + } const completedIds = list.isProgress ? list.items.filter((item) => item.doneAt).map((item) => item.id) : [];