diff --git a/src/routes/instances/+page.server.ts b/src/routes/instances/+page.server.ts index e32e8aa..05dff70 100644 --- a/src/routes/instances/+page.server.ts +++ b/src/routes/instances/+page.server.ts @@ -1,10 +1,18 @@ import instances from "./instances"; import type { PageServerLoad } from "./$types"; -export const load = (() => { +export const load = (({ url }) => { const meta = { title: "Instances" }; - return { instances, ...meta }; + // If the ?short url query exists, then longUrl is false + // Every other case is true + const queryLongUrl = !url.searchParams.has("short"); + + return { + instances, + queryLongUrl, + ...meta + }; }) satisfies PageServerLoad; diff --git a/src/routes/instances/+page.svelte b/src/routes/instances/+page.svelte index d628a77..bad8e74 100644 --- a/src/routes/instances/+page.svelte +++ b/src/routes/instances/+page.svelte @@ -3,95 +3,112 @@ export let data: PageData; - let insturl: "short" | "long"; + $: longUrl = data.queryLongUrl; + let toggle = () => { - insturl = insturl === "long" ? "short" : "long"; + longUrl = !longUrl; }; - insturl = "long";
{instance.description}
-{instance.description}
+{instance.description}
-{instance.description}
+