From 8da2860e0a77955ee59c49252b741ce82f5e2853 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Thu, 16 Jan 2025 13:53:45 -0500 Subject: [PATCH] Don't just catch everything as a flat page --- .../(pages)/{[...path] => about}/+page.svelte | 2 +- src/routes/(pages)/about/+page.ts | 26 +++++++++++++++++++ .../(pages)/help/[...path]/+page.svelte | 14 ++++++++++ .../(pages)/{ => help}/[...path]/+page.ts | 5 ++-- 4 files changed, 44 insertions(+), 3 deletions(-) rename src/routes/(pages)/{[...path] => about}/+page.svelte (74%) create mode 100644 src/routes/(pages)/about/+page.ts create mode 100644 src/routes/(pages)/help/[...path]/+page.svelte rename src/routes/(pages)/{ => help}/[...path]/+page.ts (73%) diff --git a/src/routes/(pages)/[...path]/+page.svelte b/src/routes/(pages)/about/+page.svelte similarity index 74% rename from src/routes/(pages)/[...path]/+page.svelte rename to src/routes/(pages)/about/+page.svelte index fe1c76220..f1309d212 100644 --- a/src/routes/(pages)/[...path]/+page.svelte +++ b/src/routes/(pages)/about/+page.svelte @@ -1,5 +1,5 @@ + + + {title} | DocumentCloud + + + diff --git a/src/routes/(pages)/[...path]/+page.ts b/src/routes/(pages)/help/[...path]/+page.ts similarity index 73% rename from src/routes/(pages)/[...path]/+page.ts rename to src/routes/(pages)/help/[...path]/+page.ts index 51a4da8bf..a252ee74d 100644 --- a/src/routes/(pages)/[...path]/+page.ts +++ b/src/routes/(pages)/help/[...path]/+page.ts @@ -4,10 +4,11 @@ import { error } from "@sveltejs/kit"; import { PAGE_MAX_AGE } from "@/config/config.js"; import * as flatpages from "$lib/api/flatpages"; -export const trailingSlash = "ignore"; +export const trailingSlash = "always"; export async function load({ fetch, params, setHeaders }) { - const { data, error: err } = await flatpages.get(params.path, fetch); + const path = ["help", ...params.path.split("/")].join("/"); + const { data, error: err } = await flatpages.get(path, fetch); if (err) { return error(err.status, { message: err.message });