Pages redirects file contains invalid links

Follow-up from !1606 (merged)

We generate a GitLab Pages redirect file from a YAML file as part of the website build process.

The YAML file is updated as part of the monthly maintenance tasks, using a script. The script removes expired Markdown redirects (.md files with redirect_to in the front matter) and moves them into the YAML file to become Pages redirects.

Something's off with the path handling in the script; we've added some invalid URLs, like these:

    to: /charts/nginx/_index/#adjustments-to-the-nginx-fork/
    to: /user/project/members/_index/#security-considerations/
    to: /user/group/epics/_index/#epics-as-work-items/

The _index part of these strings should not be here; redirect URLs should be valid website paths.

Some of these were added in this MR, which was created by our script: !1343 (merged)

Corresponding GitLab MR for removing the originals: gitlab-org/gitlab!206394 (merged)

Example markdown redirect that generated an invalid Pages redirect:

---
redirect_to: '_index.md#epics-as-work-items'
remove_date: '2025-09-13'
---

Just a guess but it might be related to the hash in the path.

Suggested fix

  • Update the script to handle _index properly. It should just always drop this string.
  • Consider validating the redirect URLs against the sitemap to ensure they exist. The script could warn/error if creating a redirect to a page that doesn't exist.
Edited by Sarah German