Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
include redirects from old version paths
  • Loading branch information
sarahs committed Nov 17, 2020
commit 0762631e27d4c83a2f54a7b9ab1066e506be4024
8 changes: 5 additions & 3 deletions script/archive-enterprise-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ async function createRedirectPages (permalinks, pages, finalDirectory) {
const redirects = await loadRedirects(pagesPerVersion)

Object.entries(redirects).forEach(([oldPath, newPath]) => {
// replace any liquid variables with the version number
oldPath = oldPath.replace('{{ page.version }}', version)
// remove any liquid variables that sneak in
oldPath = oldPath
.replace('/{{ page.version }}', '')
.replace('/{{ currentVersion }}', '')
// ignore any old paths that are not in this version
if (!oldPath.includes(`/enterprise-server@${version}`)) return
if (!(oldPath.includes(`/enterprise-server@${version}`) || oldPath.includes(`/enterprise/${version}`))) return

const fullPath = path.join(finalDirectory, oldPath)
const filename = `${fullPath}/index.html`
Expand Down