debug: log getPageBySlug resolution path (temp)
Deploy / verify (push) Successful in 37s
Deploy / deploy (push) Successful in 52s

This commit is contained in:
Peter Meier
2026-04-17 22:47:26 +02:00
parent f328989aa8
commit 5469b4c197
+5
View File
@@ -254,12 +254,15 @@ export async function getPageBySlug(
return fetch(u.toString());
};
let res = await trySlug(slug);
console.log(`[getPageBySlug] slug="${slug}" first=${res.status}`);
if (res.status === 404 && !slug.startsWith("/")) {
res = await trySlug("/" + slug);
console.log(`[getPageBySlug] slug="${slug}" leading-slash=${res.status}`);
}
if (res.status === 404) {
const items = await getPages();
const norm = normalizePageSlug(slug);
console.log(`[getPageBySlug] fallback items=${items.length} norm="${norm}"`);
const match = items.find(
(p) =>
normalizePageSlug(p.slug) === norm ||
@@ -267,8 +270,10 @@ export async function getPageBySlug(
p._slug === slug ||
p.slug === slug,
);
console.log(`[getPageBySlug] match=${match?._slug ?? 'NONE'}`);
if (match?._slug) {
res = await trySlug(match._slug);
console.log(`[getPageBySlug] match fetch=${res.status}`);
}
}
if (res.status === 404) return null;