Skip to content

Commit 1dd9f3c

Browse files
committed
account for homepage version
1 parent 1c9633a commit 1dd9f3c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

middleware/featured-links.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const nonEnterpriseDefaultVersion = require('../lib/non-enterprise-default-version')
23
const removeFPTFromPath = require('../lib/remove-fpt-from-path')
34

45
// this middleware adds properties to the context object
@@ -26,7 +27,8 @@ async function getLinkData (rawLinks, context) {
2627

2728
for (const link of rawLinks) {
2829
const linkPath = link.href || link
29-
const href = removeFPTFromPath(path.join('/', context.currentLanguage, context.currentVersion, linkPath))
30+
const version = context.currentVersion === 'homepage' ? nonEnterpriseDefaultVersion : context.currentVersion
31+
const href = removeFPTFromPath(path.join('/', context.currentLanguage, version, linkPath))
3032

3133
const linkedPage = context.pages[href] || context.pages[context.redirects[href]]
3234
if (!linkedPage) continue

0 commit comments

Comments
 (0)