Skip to content

Take all possible redirects into account

Achilleas Pipinellis requested to merge redirect-check-md into master

The logic of finding if a page should redirect needed changing.

We were missing the edge case where the redirect_to URL wasn't a relative URL and didn't end in .html.

With the new rules:

  1. If a document has the redirect_url set to:
    1. a relative .md URL, replace .md with .html and use that URL to redirect.
    2. a relative .html URL, use that URL and redirect.
    3. an external .md URL, replace .md with .html and use that URL to redirect.
    4. an external .html URL, use that URL and redirect.
    5. an external clean URL, use that URL and redirect.
  2. Similarly, if there isn't a redirect_to, the This document was moved to [here](link) notation is taken into account with link behaving the same as the value of redirect_url.

Test with:

Closes https://gitlab.com/gitlab-com/gitlab-docs/issues/304

Edited by Achilleas Pipinellis

Merge request reports