Skip to content

Add archives redirect to 404

Sarah German requested to merge sarahg/archives-redirect into main

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:

  1. Install nginx with homebrew: brew install nginx
  2. Find the config file: nginx -t
  3. Edit this file, and look for the server block. Replace the location and error_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)

  1. Test your config syntax: nginx -t
  2. If the last step returned "OK," start nginx: nginx
  3. In theory, you can now see the site at http://localhost:8080, and visiting a 404 like http://localhost:8080/abc123 shows our GitLab Docs 404.

Now you can test the actual redirect! Check out this branch, and try these links:

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.

Edited by Sarah German

Merge request reports