This commit is contained in:
Sarah Schneider 2021-01-15 10:11:17 -05:00
Родитель 308e62616d
Коммит 51da7a9749
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -41,6 +41,7 @@ module.exports = function generateRedirectsForPermalinks (permalinks, redirectFr
// add it to the redirects object
redirects[versionedFrontmatterOldPath] = permalink.href
redirects[`/en${versionedFrontmatterOldPath}`] = permalink.href
// then get an array of possible alternative old paths from the current versioned old path
const possibleOldPathsForVersionedOldPaths = getOldPathsFromPermalink(versionedFrontmatterOldPath, permalink.languageCode, permalink.pageVersion)

Просмотреть файл

@ -3,7 +3,7 @@ const products = Object.values(require('./all-products'))
const languageCodes = Object.keys(require('./languages'))
const addTitlesToTree = require('./site-tree-titles')
const allVersions = Object.keys(require('./all-versions'))
const { getVersionStringFromPath } = require('./path-utils')
const { getPathWithoutVersion } = require('./path-utils')
const getApplicableVersions = require('./get-applicable-versions')
const findPage = require('./find-page')
@ -46,8 +46,7 @@ module.exports = async function buildSiteTree (pageMap, site, redirects) {
if (!getApplicableVersions(page.versions).includes(version)) return
// item.hrefs have a default version via lib/all-products, so update to the current version
const versionFromPath = getVersionStringFromPath(item.href)
const versionedProductHref = path.join('/', languageCode, item.href.replace(versionFromPath, version))
const versionedProductHref = path.join('/', languageCode, version, getPathWithoutVersion(item.href))
product.categories = buildCategoriesTree(page.tocItems, versionedProductHref, pageMap, redirects, version)