From bed7d508ff3f383972c2baa74864c3a8e7bbe394 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 29 Sep 2024 18:45:35 -0700 Subject: [PATCH] feat: Render pages --- src/hooks.ts | 11 +++++++++++ src/lib/components/PostHeader.svelte | 2 +- src/lib/posts.ts | 2 +- src/routes/Navbar.svelte | 3 ++- src/routes/gallery/+page.svelte | 0 src/routes/page/[slug]/+page.svelte | 7 ++++--- src/routes/tag/+page.svelte | 0 svelte.config.js | 6 ++++++ tests/post.spec.ts | 7 +++++++ 9 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/hooks.ts create mode 100644 src/routes/gallery/+page.svelte create mode 100644 src/routes/tag/+page.svelte create mode 100644 tests/post.spec.ts diff --git a/src/hooks.ts b/src/hooks.ts new file mode 100644 index 0000000..7ea2285 --- /dev/null +++ b/src/hooks.ts @@ -0,0 +1,11 @@ +import type { Reroute } from '@sveltejs/kit'; + +const translated: Record = { + '/post': '/page/1', +}; + +export const reroute: Reroute = ({ url }) => { + if (url.pathname in translated) { + return translated[url.pathname]; + } +}; diff --git a/src/lib/components/PostHeader.svelte b/src/lib/components/PostHeader.svelte index 8911892..0d01ff6 100644 --- a/src/lib/components/PostHeader.svelte +++ b/src/lib/components/PostHeader.svelte @@ -35,7 +35,7 @@