Skip to content

Commit d9b1fa9

Browse files
committed
use new module
1 parent ae0aabf commit d9b1fa9

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

middleware/featured-links.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
const findPage = require('../lib/find-page')
2-
const getApplicableVersions = require('../lib/get-applicable-versions')
1+
const findPageInVersion = require('../lib/find-page-in-version')
32
const { getVersionedPathWithLanguage } = require('../lib/path-utils')
43

54
// this middleware adds properties to the context object
@@ -30,14 +29,9 @@ async function getLinkData (rawLinks, context) {
3029
? getVersionedPathWithLanguage(link.href, context.currentVersion, context.currentLanguage)
3130
: getVersionedPathWithLanguage(link, context.currentVersion, context.currentLanguage)
3231

33-
const linkedPage = findPage(href, context.pages, context.redirects, context.currentLanguage)
32+
const linkedPage = findPageInVersion(href, context.pages, context.redirects, context.currentLanguage, context.currentVersion)
3433
if (!linkedPage) continue
3534

36-
const applicableVersions = getApplicableVersions(linkedPage.versions, linkedPage.fullPath)
37-
38-
// skip link if this is not the homepage and the link's versions do not include the current version
39-
if (context.currentVersion !== 'homepage' && !applicableVersions.includes(context.currentVersion)) continue
40-
4135
const opts = { textOnly: true, encodeEntities: true }
4236

4337
links.push({

0 commit comments

Comments
 (0)