Skip to content

Commit 5c166f0

Browse files
committed
we can use req.path for maptopic and article lookups now that siteTree paths include the lang code
1 parent 471c6d1 commit 5c166f0

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

middleware/breadcrumbs.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = async (req, res, next) => {
4949
// e.g., /github/getting-started-with-github/learning-about-github
5050
let maptopic
5151
if (req.context.page.mapTopic) {
52-
const maptopicPath = path.posix.join(categoryPath, pathParts[2])
52+
const maptopicPath = req.path
5353

5454
maptopic = category.maptopics[maptopicPath]
5555

@@ -60,9 +60,7 @@ module.exports = async (req, res, next) => {
6060
title: maptopic.shortTitle || maptopic.title
6161
}
6262
} else {
63-
// get article path
64-
// e.g., /github/getting-started-with-github/githubs-products
65-
const articlePath = path.posix.join(categoryPath, pathParts[2])
63+
const articlePath = req.path
6664

6765
// find parent maptopic if one exists
6866
// some categories don't have maptopics, e.g. site-policy

0 commit comments

Comments
 (0)