Skip to content

Commit 1aa8099

Browse files
committed
try to make this check as fast as we can
1 parent afbd4b7 commit 1aa8099

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/redirects/permalinks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const patterns = require('../patterns')
22
const { getVersionedPathWithLanguage, getVersionStringFromPath } = require('../path-utils')
3-
const allVersions = Object.keys(require('../all-versions'))
3+
const supportedVersions = new Set(Object.keys(require('../all-versions')))
44
const getOldPathsFromPermalink = require('./get-old-paths-from-permalink')
55

66
module.exports = function generateRedirectsForPermalinks (permalinks, redirectFrontmatter) {
@@ -27,7 +27,7 @@ module.exports = function generateRedirectsForPermalinks (permalinks, redirectFr
2727
frontmatterOldPath = frontmatterOldPath.replace(patterns.trailingSlash, '$1')
2828

2929
// support hardcoded versions in redirect frontmatter
30-
if (allVersions.includes(getVersionStringFromPath(frontmatterOldPath))) {
30+
if (supportedVersions.has(frontmatterOldPath.split('/')[1])) {
3131
redirects[frontmatterOldPath] = permalink.href
3232
redirects[`/en${frontmatterOldPath}`] = permalink.href
3333
}

0 commit comments

Comments
 (0)