From ac21ba703185cef6c2c2bdd2fc96a511df44525d Mon Sep 17 00:00:00 2001 From: "Kent Joseph T. Palima" Date: Mon, 4 May 2026 12:03:15 +0800 Subject: [PATCH] Fixed shortlink redirections --- src/pages/[...path].astro | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/pages/[...path].astro b/src/pages/[...path].astro index c01dc2d..a6efe14 100644 --- a/src/pages/[...path].astro +++ b/src/pages/[...path].astro @@ -7,17 +7,14 @@ const { path } = Astro.params; // 2. Check for our loop-breaker const isLooping = Astro.url.searchParams.get('noloop') === 'true'; -// 3. Define the shortlink target (ensuring we don't double the slash) -const shortlinkUrl = `https://upiecep.org/${path || ''}`; - -// 4. SERVER-SIDE REDIRECT LOGIC -// If we didn't come from Short.io (noloop is missing), bounce back to the shortener once. +// 3. SERVER-SIDE REDIRECT LOGIC if (!isLooping) { - return Astro.redirect(shortlinkUrl); + // We inline the URL here. This removes the "unused variable" warning + // and keeps the logic tight. + return Astro.redirect(`https://upiecep.org/${path || ''}`); } -// 5. If we reach here, it's a confirmed 404 (Short.io already checked). -// Manually set the response status to 404 for SEO purposes. +// 4. If we reach here, it's a confirmed 404 (Short.io already checked). Astro.response.status = 404; --- @@ -33,7 +30,6 @@ Astro.response.status = 404;
Go to Homepage -