From 1dd9f3cbf1b597c164992f1444ab5e3e262c0968 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Thu, 7 Jan 2021 15:21:22 -0500 Subject: [PATCH] account for homepage version --- middleware/featured-links.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/middleware/featured-links.js b/middleware/featured-links.js index 7b3a55dec2..7d36520d46 100644 --- a/middleware/featured-links.js +++ b/middleware/featured-links.js @@ -1,4 +1,5 @@ const path = require('path') +const nonEnterpriseDefaultVersion = require('../lib/non-enterprise-default-version') const removeFPTFromPath = require('../lib/remove-fpt-from-path') // this middleware adds properties to the context object @@ -26,7 +27,8 @@ async function getLinkData (rawLinks, context) { for (const link of rawLinks) { const linkPath = link.href || link - const href = removeFPTFromPath(path.join('/', context.currentLanguage, context.currentVersion, linkPath)) + const version = context.currentVersion === 'homepage' ? nonEnterpriseDefaultVersion : context.currentVersion + const href = removeFPTFromPath(path.join('/', context.currentLanguage, version, linkPath)) const linkedPage = context.pages[href] || context.pages[context.redirects[href]] if (!linkedPage) continue