Skip to content

Commit 04f0eb7

Browse files
authored
Merge pull request #16502 from github/few-more-archival-script-tweaks
A few more archival script tweaks
2 parents e9ed2aa + 23e614f commit 04f0eb7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

script/archive-enterprise-version.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async function main () {
9797
console.log(`Enterprise version to archive: ${version}`)
9898
const pages = await (require('../lib/pages')())
9999
const permalinksPerVersion = Object.keys(pages)
100-
.filter(key => key.includes(`/enterprise/${version}`))
100+
.filter(key => key.includes(`/enterprise-server@${version}`))
101101

102102
const urls = dryRun
103103
? permalinksPerVersion.slice(0, 10).map(href => `${host}${href}`)
@@ -162,10 +162,12 @@ async function createRedirectPages (permalinks, pages, finalDirectory) {
162162
const redirects = await loadRedirects(pagesPerVersion)
163163

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

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

0 commit comments

Comments
 (0)