Skip to content

Commit 6ce17ce

Browse files
authored
Merge branch 'main' into repo-sync
2 parents 774adba + ba95c62 commit 6ce17ce

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

middleware/is-next-request.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ const { FEATURE_NEXTJS } = process.env;
88
const enabledSubSections = [
99
// 'actions',
1010
// 'admin',
11-
// "billing",
11+
"billing",
1212
// "code-security",
1313
// "codespaces",
1414
// "communities",
1515
// "desktop",
1616
// "developers",
17-
// "discussions",
17+
"discussions",
1818
// 'early-access',
1919
// "education",
2020
// 'github',
2121
// "graphql",
2222
// 'insights',
2323
// "issues",
24-
// "organizations",
24+
"organizations",
2525
// 'packages',
2626
// "pages",
2727
// "rest",
28-
// "sponsors",
28+
"sponsors",
2929
];
3030

3131
const homePageExp = pathToRegexp('/:locale/:versionId?')
3232
const productPageExp = pathToRegexp('/:locale/:versionId?/:productId')
33-
const subSectionExp = pathToRegexp('/:locale/:versionId?/:productId/:subSection')
33+
const subSectionExp = pathToRegexp('/:locale/:versionId?/:productId/:subSection*')
3434

3535
module.exports = function isNextRequest(req, res, next) {
3636
req.renderWithNextjs = false;
@@ -53,7 +53,8 @@ module.exports = function isNextRequest(req, res, next) {
5353
} else if (productPageMatch && productIds.includes(productPageMatch[3])) {
5454
req.renderWithNextjs = true
5555
} else if (subSectionMatch) {
56-
req.renderWithNextjs = enabledSubSections.includes(subSectionMatch[4])
56+
// depending on whether versionId is included the productId is in a different place
57+
req.renderWithNextjs = enabledSubSections.includes(subSectionMatch[2]) || enabledSubSections.includes(subSectionMatch[3])
5758
}
5859
}
5960
}

0 commit comments

Comments
 (0)