style: optimize cachePathname assignment

This commit is contained in:
Gauthier Daniels 2025-04-22 17:00:16 +02:00
parent 3f1b0fc18a
commit 874113db96

View File

@ -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"],
}), }),
}; };
} }