import { redirect } from '@sveltejs/kit'; // Keep legacy root-query links alive after the cutover: the old feed lived at `/` // (e.g. /?view=latest, /?tag=…, /?source=…, /?q=…); the feed is now /news. Redirect // here in load() — before the hub renders — so bookmarks/old shares never flash the // hub. Bare `/` (no query) falls through to the hub. parseView's alias keeps // /news?view=today working too. export function load({ url }) { const p = url.searchParams; if (p.get('q')) throw redirect(307, '/news?q=' + encodeURIComponent(p.get('q'))); if (p.get('source')) throw redirect(307, '/news?source=' + encodeURIComponent(p.get('source'))); if (p.get('tag')) throw redirect(307, '/news?tag=' + encodeURIComponent(p.get('tag'))); const v = p.get('view'); if (v === 'today') throw redirect(307, '/news?view=highlights'); if (v === 'latest') throw redirect(307, '/news'); if (v) throw redirect(307, '/news?view=' + encodeURIComponent(v)); }