Skip to content

Commit 2cb4d60

Browse files
authored
Merge pull request github#26086 from github/peterbe-1673-breadcrumbs-fail-on-some-enterprise-server-uris
breadcrumbs fail on some enterprise-server URIs
2 parents a1aad93 + fb52ab2 commit 2cb4d60

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

middleware/contextualizers/breadcrumbs.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ async function getBreadcrumbs(req) {
2323
while (split.length > 2 && split[split.length - 1] !== currentVersion) {
2424
const href = split.join('/')
2525
const page = req.context.pages[href]
26-
crumbs.push({
27-
href,
28-
title: await getShortTitle(page, req.context),
29-
})
26+
if (page) {
27+
crumbs.push({
28+
href,
29+
title: await getShortTitle(page, req.context),
30+
})
31+
} else {
32+
console.warn(`No page found with for '${href}'`)
33+
}
3034
split.pop()
3135
}
3236
crumbs.reverse()

0 commit comments

Comments
 (0)