style: optimize cachePathname assignment
This commit is contained in:
parent
3f1b0fc18a
commit
874113db96
@ -22,9 +22,7 @@ export async function data(pageContext: PageContext) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, "");
|
let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, "");
|
||||||
if (cachePathname === "") {
|
if (cachePathname === "") cachePathname = "index";
|
||||||
cachePathname = "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
const doc = docCache.get(cachePathname);
|
const doc = docCache.get(cachePathname);
|
||||||
|
|
||||||
@ -41,7 +39,7 @@ export async function data(pageContext: PageContext) {
|
|||||||
docs: docCache.orderByLastEdit({
|
docs: docCache.orderByLastEdit({
|
||||||
limit: 2,
|
limit: 2,
|
||||||
includedBasePaths: ["docs", "certifications"],
|
includedBasePaths: ["docs", "certifications"],
|
||||||
excludedFileNames: [cachePathname],
|
excludedFileNames: [cachePathname, "docs", "certifications"],
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user