1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Fix redirect logic for early-access paths containing /enterprise/ (#58213)

This commit is contained in:
Kevin Heis
2025-10-27 08:46:19 -07:00
committed by GitHub
parent ccc986f7ac
commit 0bfa26d4e1

View File

@@ -33,9 +33,12 @@ export default function permalinkRedirects(
}
// Exceptions where the `redirect_from` entries are too old
// Only replace /enterprise/ when it's at the start of the path followed by /admin/
// This handles legacy patterns like /enterprise/admin/... → /admin/...
// but preserves paths like /early-access/enterprise/... where enterprise is a directory name
frontmatterOldPath = frontmatterOldPath
.replace('/admin/guides/', '/admin/')
.replace('/enterprise/', '/')
.replace(/^\/enterprise\/admin\//, '/admin/')
permalinks.forEach((permalink, index) => {
// For the first supported permalink (the order is determined by lib/all-versions),