remove the else, that was the problem
This commit is contained in:
@@ -15,8 +15,6 @@ export default function permalinkRedirects(permalinks, redirectFrom) {
|
||||
permalinks[0].hrefWithoutLanguage
|
||||
}
|
||||
|
||||
redirectFrom = Array.isArray(redirectFrom) ? redirectFrom : [redirectFrom]
|
||||
|
||||
// For every "old" path in a content file's redirect_from frontmatter, also add that path to
|
||||
// the redirects object as a key, where the value is the content file's permalink.
|
||||
redirectFrom.forEach((frontmatterOldPath) => {
|
||||
@@ -32,13 +30,14 @@ export default function permalinkRedirects(permalinks, redirectFrom) {
|
||||
.replace('/enterprise/', '/')
|
||||
|
||||
permalinks.forEach((permalink, index) => {
|
||||
// Put an entry into `redirects` without any version prefix that goes to the first supported
|
||||
// version in the lib/all-versions hierarchy; otherwise, add the version prefix.
|
||||
// For the first supported permalink (the order is determined by lib/all-versions),
|
||||
// put an entry into `redirects` without any version prefix.
|
||||
if (index === 0) {
|
||||
redirects[frontmatterOldPath] = permalink.hrefWithoutLanguage
|
||||
} else {
|
||||
redirects[`/${permalink.pageVersion}${frontmatterOldPath}`] = permalink.hrefWithoutLanguage
|
||||
}
|
||||
|
||||
// For every permalink, put an entry into `redirects` with the version prefix.
|
||||
redirects[`/${permalink.pageVersion}${frontmatterOldPath}`] = permalink.hrefWithoutLanguage
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user