Add a redirect to the primary Archives listing
We had a bug in some past versions of the Docs site where the link to the Archives page on the versions menu was incorrect (it was relative rather than absolute).
We fixed this in 16.1: gitlab-docs!3853 (merged)
The bug still exists in some Archive versions, for example, here: https://archives.docs.gitlab.com/15.11/ (click Archives
on the versions drop-down).
We can improve this issue by adding a redirect handler to the Archives site 404: redirect requests to archives.docs.gitlab.com/archives => docs.gitlab.com/archives. This is a quicker fix than backporting the "real" fix to several older versions.
How to test
Can't test this one easily locally because the Vite dev server does not do 404 handling in the same way GitLab Pages does.
You can (mostly) test in your browser, using the dev tools console, like this:
- Go to the non-existent
/archives
page, which will throw a 404: https://archives.docs.gitlab.com/archives - In the browser console, run the same code as what we're adding in this MR:
if (window.location.pathname === '/archives') {
window.location.href = "https://docs.gitlab.com/archives"
}
- Try the same thing on a 404 that should not redirect, like https://archives.docs.gitlab.com/asdf
For example: