Skip to content

Set up redirects to handle path changes

As part of moving to Hugo, we're modifying URL paths:

  1. Dropping the ee prefix from pages from the gitlab repo
  2. Using Hugo's pretty URLs setting to drop the .html suffix (this won't actually be possible, see !139 (merged))

We don't want to break links, so we'll need to provide redirect logic.

For example:

Original: https://docs.gitlab.com/ee/api/get_started/get_started_extending.html
Redirect: https://docs.gitlab.com/api/get_started/get_started_extending.html

Ideally we can handle these at the server level with GitLab Pages redirects: https://docs.gitlab.com/ee/user/project/pages/redirects.html

Remember that GitLab Pages redirects won't work locally. We'll only be able to validate these once they've been deployed.

If it's not too much extra work, maybe we could configure Hugo Server to redirect these as well: https://gohugo.io/getting-started/configuration/#configure-server (this would only affect local dev sites) (This is not currently possible: https://github.com/gohugoio/hugo/issues/7713)

Related

How redirects are used: https://docs.gitlab.com/ee/development/documentation/redirects.html

Other redirect-related work:

Edited by Sarah German