Add archives redirect to 404
What does this MR do and why?
Closes #1293 (closed)
Updates behavior on the 404 page:
- Removes the error_message component previously used to display a message about available archives
- Adds logic to redirect the visitor to the Archives site if the request was to a supported archived version
This change will allow users running all older supported versions (currently this goes back to 13.0) to be able to visit docs.gitlab.com/$ANY_OLD_VERSION/some-page
and have a working link.
Bigger picture, this is a step towards retiring /help
.
Screenshots, screen recordings, or links to review app
n/a (can't test this on the review app)
How to set up and validate locally
This is tough to test locally since the nanoc live
webserver does not allow custom 404 error pages. You'll need to first set up a different webserver and configure that to use the custom 404. Here are instructions for nginx on OSX:
- Install nginx with homebrew:
brew install nginx
- Find the config file:
nginx -t
- Edit this file, and look for the
server
block. Replace thelocation
anderror_page
sections with this:
location / {
root /Users/sarahg/dev/docs/public;
index index.html;
}
error_page 404 /404.html;
(adjust your root path accordingly; this should point at the public dir in your local docs site directory)
- Test your config syntax:
nginx -t
- If the last step returned "OK," start nginx:
nginx
- In theory, you can now see the site at
http://localhost:8080
, and visiting a 404 likehttp://localhost:8080/abc123
shows our GitLab Docs 404.
Now you can test the actual redirect! Check out this branch, and try these links:
- http://localhost:8080/14.5/ee/user/project/ (redirects to the archives site)
- http://localhost:8080/13.1/ee/user/project/ (redirects to the archives site)
- http://localhost:8080/awdfasdf (should not redirect, just throw the 404)
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.