diff --git a/lib/render-content/plugins/rewrite-local-links.js b/lib/render-content/plugins/rewrite-local-links.js index f4ee823ba9..cdcbf0a9bc 100644 --- a/lib/render-content/plugins/rewrite-local-links.js +++ b/lib/render-content/plugins/rewrite-local-links.js @@ -10,7 +10,7 @@ import removeFPTFromPath from '../../remove-fpt-from-path.js' import readJsonFile from '../../read-json-file.js' const supportedVersions = Object.keys(allVersions) const supportedPlans = Object.values(allVersions).map((v) => v.plan) -const externalRedirects = Object.keys(readJsonFile('./lib/redirects/external-sites.json')) +const externalRedirects = readJsonFile('./lib/redirects/external-sites.json') // Matches any tags with an href that starts with `/` const matcher = (node) => @@ -41,7 +41,7 @@ function getNewHref(node, languageCode, version) { // Exceptions to link rewriting if (href.startsWith('/assets')) return if (href.startsWith('/public')) return - if (externalRedirects.includes(href)) return + if (href in externalRedirects) return let newHref = href // If the link has a hardcoded plan or version in it, do not update other than adding a language code