Skip to content

Commit

Permalink
Redirect support for archived release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
chgeo committed Aug 14, 2023
1 parent 754643d commit ff9c1e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vitepress/lib/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export function collect(file:string, frontmatter:Record<string, any>, siteConfig
froms = (typeof froms === 'string') ? [froms] : froms
froms.forEach(from => links[from] = urlPath)
}

// keep URL for release notes that were moved to archive, e.g. releases/jun22 -> releases/archive/2022/jun22
for (const result of urlPath.matchAll(/releases\/archive\/.*?\/(.*)/g)) {
const from = `releases/${result[1]}`
links[from] = urlPath
}
}

function fileToUrlPath(file: string, siteConfig:SiteConfig):string {
Expand Down

0 comments on commit ff9c1e4

Please sign in to comment.