refactor: Update variable assignment and conditional check
This commit is contained in:
parent
394399a394
commit
364c548aa8
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user