From 364c548aa806ac62121ca64d18c958764cd2f88d Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Sun, 20 Apr 2025 16:36:35 +0200 Subject: [PATCH] refactor: Update variable assignment and conditional check --- app/pages/+config.ts | 4 ++-- app/pages/+data.ts | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/pages/+config.ts b/app/pages/+config.ts index 7c3a382..18b2a09 100755 --- a/app/pages/+config.ts +++ b/app/pages/+config.ts @@ -25,8 +25,8 @@ export default { class: "flex min-h-full bg-white", }, - // prerender: true, - // prefetchStaticAssets: "hover", + prerender: true, + prefetchStaticAssets: "hover", extends: [vikeSolid], } satisfies Config; diff --git a/app/pages/+data.ts b/app/pages/+data.ts index e5f8cb4..4912417 100644 --- a/app/pages/+data.ts +++ b/app/pages/+data.ts @@ -21,14 +21,13 @@ export async function data(pageContext: PageContext) { description: frontmatter?.description, }); - let doc: SectionCache | undefined; - - if (urlParsed.pathname === "/") { - doc = docCache.get("index"); - } else { - doc = docCache.get(urlParsed.pathname); + let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, ""); + if (cachePathname === "") { + cachePathname = "index"; } + const doc = docCache.get(cachePathname); + return { sections: doc?.sections || [], frontmatter,